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.



8
9
10
# File 'lib/cfa/memory_file.rb', line 8

def initialize(content = "")
  @content = content
end

Instance Attribute Details

#contentObject

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