Class: Trenni::IOBuffer
- Inherits:
-
Object
- Object
- Trenni::IOBuffer
- Defined in:
- lib/trenni/buffer.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #encoding ⇒ Object
- #freeze ⇒ Object
-
#initialize(io, path: io.inspect) ⇒ IOBuffer
constructor
A new instance of IOBuffer.
- #read ⇒ Object
- #to_buffer ⇒ Object
Constructor Details
#initialize(io, path: io.inspect) ⇒ IOBuffer
Returns a new instance of IOBuffer.
82 83 84 85 |
# File 'lib/trenni/buffer.rb', line 82 def initialize(io, path: io.inspect) @io = io @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
95 96 97 |
# File 'lib/trenni/buffer.rb', line 95 def path @path end |
Instance Method Details
#encoding ⇒ Object
97 98 99 |
# File 'lib/trenni/buffer.rb', line 97 def encoding read.encoding end |
#freeze ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/trenni/buffer.rb', line 87 def freeze return self if frozen? read super end |
#read ⇒ Object
101 102 103 |
# File 'lib/trenni/buffer.rb', line 101 def read @cache ||= @io.read.freeze end |