Class: Trenni::Buffer
- Inherits:
-
Object
- Object
- Trenni::Buffer
- Defined in:
- lib/trenni/buffer.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #encoding ⇒ Object
-
#initialize(string, path: '<string>') ⇒ Buffer
constructor
A new instance of Buffer.
- #read ⇒ Object
- #to_buffer ⇒ Object
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
#path ⇒ Object (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
#encoding ⇒ Object
32 33 34 |
# File 'lib/trenni/buffer.rb', line 32 def encoding @string.encoding end |
#read ⇒ Object
36 37 38 |
# File 'lib/trenni/buffer.rb', line 36 def read @string end |
#to_buffer ⇒ Object
48 49 50 |
# File 'lib/trenni/buffer.rb', line 48 def to_buffer self end |