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.
23 24 25 26 |
# File 'lib/trenni/buffer.rb', line 23 def initialize(string, path: '<string>') @string = string @path = path end |
Instance Attribute Details
#path ⇒ Object (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
#encoding ⇒ Object
30 31 32 |
# File 'lib/trenni/buffer.rb', line 30 def encoding @string.encoding end |
#read ⇒ Object
34 35 36 |
# File 'lib/trenni/buffer.rb', line 34 def read @string end |
#to_buffer ⇒ Object
46 47 48 |
# File 'lib/trenni/buffer.rb', line 46 def to_buffer self end |