Class: Trenni::FileBuffer
- Inherits:
-
Object
- Object
- Trenni::FileBuffer
- 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(path) ⇒ FileBuffer
constructor
A new instance of FileBuffer.
- #read ⇒ Object
- #to_buffer ⇒ Object
Constructor Details
#initialize(path) ⇒ FileBuffer
Returns a new instance of FileBuffer.
54 55 56 |
# File 'lib/trenni/buffer.rb', line 54 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
66 67 68 |
# File 'lib/trenni/buffer.rb', line 66 def path @path end |
Instance Method Details
#encoding ⇒ Object
68 69 70 |
# File 'lib/trenni/buffer.rb', line 68 def encoding read.encoding end |
#freeze ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/trenni/buffer.rb', line 58 def freeze return self if frozen? read super end |
#read ⇒ Object
72 73 74 |
# File 'lib/trenni/buffer.rb', line 72 def read @cache ||= File.read(@path).freeze end |