Class: SMPTool::VirtualVolume::FileInterface
- Inherits:
-
Object
- Object
- SMPTool::VirtualVolume::FileInterface
- Defined in:
- lib/smp_tool/virtual_volume/file_interface.rb
Overview
Interface to add/retrieve files to/from a volume.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#filename ⇒ Object
Returns the value of attribute filename.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Hash-like interface to access keys in the
[]
syntax. -
#[]=(key, value) ⇒ Object
Hash-like interface to access keys in the
[]=
syntax. -
#initialize(filename:, data:) ⇒ FileInterface
constructor
A new instance of FileInterface.
-
#to_h ⇒ Object
Return ‘self` as a hash.
Constructor Details
#initialize(filename:, data:) ⇒ FileInterface
Returns a new instance of FileInterface.
11 12 13 14 |
# File 'lib/smp_tool/virtual_volume/file_interface.rb', line 11 def initialize(filename:, data:) @filename = filename @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
9 10 11 |
# File 'lib/smp_tool/virtual_volume/file_interface.rb', line 9 def data @data end |
#filename ⇒ Object
Returns the value of attribute filename.
9 10 11 |
# File 'lib/smp_tool/virtual_volume/file_interface.rb', line 9 def filename @filename end |
Instance Method Details
#[](key) ⇒ Object
Hash-like interface to access keys in the []
syntax.
17 |
# File 'lib/smp_tool/virtual_volume/file_interface.rb', line 17 def [](key) = send(key) |
#[]=(key, value) ⇒ Object
Hash-like interface to access keys in the []=
syntax.
20 21 22 |
# File 'lib/smp_tool/virtual_volume/file_interface.rb', line 20 def []=(key, value) send("#{key}=", value) end |
#to_h ⇒ Object
Return ‘self` as a hash.
25 26 27 28 29 30 |
# File 'lib/smp_tool/virtual_volume/file_interface.rb', line 25 def to_h { filename: @filename, data: @data } end |