Class: CFA::MemoryFile
- Inherits:
-
Object
- Object
- CFA::MemoryFile
- Defined in:
- lib/cfa/memory_file.rb
Overview
memory file is used when string is stored only in memory. Useful for testing. For remote read or socket read, own File class creation is recommended.
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
-
#initialize(content = "") ⇒ MemoryFile
constructor
A new instance of MemoryFile.
- #read(_path) ⇒ Object
- #write(_path, content) ⇒ Object
Constructor Details
#initialize(content = "") ⇒ MemoryFile
Returns a new instance of MemoryFile.
8 9 10 |
# File 'lib/cfa/memory_file.rb', line 8 def initialize(content = "") @content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
6 7 8 |
# File 'lib/cfa/memory_file.rb', line 6 def content @content end |
Instance Method Details
#read(_path) ⇒ Object
12 13 14 |
# File 'lib/cfa/memory_file.rb', line 12 def read(_path) @content.dup end |
#write(_path, content) ⇒ Object
16 17 18 |
# File 'lib/cfa/memory_file.rb', line 16 def write(_path, content) @content = content end |