Class: Trenni::Buffer

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, path: '<string>') ⇒ Buffer

Returns a new instance of Buffer.



25
26
27
28
# File 'lib/trenni/buffer.rb', line 25

def initialize(string, path: '<string>')
	@string = string
	@path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



30
31
32
# File 'lib/trenni/buffer.rb', line 30

def path
  @path
end

Class Method Details

.load(string) ⇒ Object



44
45
46
# File 'lib/trenni/buffer.rb', line 44

def self.load(string)
	Buffer.new(string).freeze
end

.load_file(path) ⇒ Object



40
41
42
# File 'lib/trenni/buffer.rb', line 40

def self.load_file(path)
	FileBuffer.new(path).freeze
end

Instance Method Details

#encodingObject



32
33
34
# File 'lib/trenni/buffer.rb', line 32

def encoding
	@string.encoding
end

#readObject



36
37
38
# File 'lib/trenni/buffer.rb', line 36

def read
	@string
end

#to_bufferObject



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

def to_buffer
	self
end