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.
10 11 12 |
# File 'lib/cfa/memory_file.rb', line 10 def initialize(content = "") @content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
8 9 10 |
# File 'lib/cfa/memory_file.rb', line 8 def content @content end |
Instance Method Details
#read(_path) ⇒ Object
14 15 16 |
# File 'lib/cfa/memory_file.rb', line 14 def read(_path) @content.dup end |
#write(_path, content) ⇒ Object
18 19 20 |
# File 'lib/cfa/memory_file.rb', line 18 def write(_path, content) @content = content end |