class HDOC::Log

Provides methods for interact with the log file.

Attributes

log_path[R]

Public Class Methods

new(log_path) click to toggle source
# File lib/1hdoc/core/log.rb, line 12
def initialize(log_path)
  @log_path = File.expand_path(log_path)
  raise Errno::ENOENT unless File.exist? log_path
end
reset(log_path) click to toggle source
# File lib/1hdoc/core/log.rb, line 7
def self.reset(log_path)
  log_path = File.expand_path(log_path)
  File.open(log_path, 'w') { |log| log.print '' }
end

Public Instance Methods

append(content) click to toggle source
# File lib/1hdoc/core/log.rb, line 17
def append(content)
  File.open(log_path, 'a') { |log| log.puts content }
end