Class: CFA::MemoryFile

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#contentObject

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