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.



23
24
25
26
# File 'lib/trenni/buffer.rb', line 23

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



28
29
30
# File 'lib/trenni/buffer.rb', line 28

def path
  @path
end

Class Method Details

.load(string) ⇒ Object



42
43
44
# File 'lib/trenni/buffer.rb', line 42

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

.load_file(path) ⇒ Object



38
39
40
# File 'lib/trenni/buffer.rb', line 38

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

Instance Method Details

#encodingObject



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

def encoding
	@string.encoding
end

#readObject



34
35
36
# File 'lib/trenni/buffer.rb', line 34

def read
	@string
end

#to_bufferObject



46
47
48
# File 'lib/trenni/buffer.rb', line 46

def to_buffer
	self
end