Class: Buncho::BaseLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/buncho/base_logger.rb

Direct Known Subclasses

NameLogger, WeightLogger

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ BaseLogger

Returns a new instance of BaseLogger.



5
6
7
8
# File 'lib/buncho/base_logger.rb', line 5

def initialize(path)
  @path = File.expand_path(path, __FILE__)
  @io = File.open(path, "a+")
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/buncho/base_logger.rb', line 3

def path
  @path
end

Instance Method Details

#read_linesObject



10
11
12
13
# File 'lib/buncho/base_logger.rb', line 10

def read_lines
  @io.rewind
  File.exist?(@path) ? @io.read.split("\n") : []
end