Class: Trenni::FileBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/trenni/buffer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FileBuffer

Returns a new instance of FileBuffer.


48
49
50
# File 'lib/trenni/buffer.rb', line 48

def initialize(path)
	@path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path


52
53
54
# File 'lib/trenni/buffer.rb', line 52

def path
  @path
end

Instance Method Details

#readObject


54
55
56
# File 'lib/trenni/buffer.rb', line 54

def read
	@buffer ||= File.read(@path)
end

#to_bufferObject


58
59
60
# File 'lib/trenni/buffer.rb', line 58

def to_buffer
	Buffer.new(self.read, @path)
end