Class: Laboratory::Adapters::MockAdapter
- Inherits:
-
Object
- Object
- Laboratory::Adapters::MockAdapter
- Defined in:
- lib/laboratory/adapters/mock_adapter.rb
Instance Attribute Summary collapse
-
#experiment_hash ⇒ Object
Returns the value of attribute experiment_hash.
Instance Method Summary collapse
- #delete(experiment_id) ⇒ Object
- #delete_all ⇒ Object
-
#initialize ⇒ MockAdapter
constructor
A new instance of MockAdapter.
- #read(experiment_id) ⇒ Object
- #read_all ⇒ Object
- #write(experiment) ⇒ Object
Constructor Details
#initialize ⇒ MockAdapter
Returns a new instance of MockAdapter.
6 7 8 |
# File 'lib/laboratory/adapters/mock_adapter.rb', line 6 def initialize @experiment_hash = {} end |
Instance Attribute Details
#experiment_hash ⇒ Object
Returns the value of attribute experiment_hash.
4 5 6 |
# File 'lib/laboratory/adapters/mock_adapter.rb', line 4 def experiment_hash @experiment_hash end |
Instance Method Details
#delete(experiment_id) ⇒ Object
22 23 24 |
# File 'lib/laboratory/adapters/mock_adapter.rb', line 22 def delete(experiment_id) experiment_hash.delete(experiment_id) end |
#delete_all ⇒ Object
26 27 28 |
# File 'lib/laboratory/adapters/mock_adapter.rb', line 26 def delete_all @experiment_hash = {} end |
#read(experiment_id) ⇒ Object
18 19 20 |
# File 'lib/laboratory/adapters/mock_adapter.rb', line 18 def read(experiment_id) experiment_hash[experiment_id] end |
#read_all ⇒ Object
14 15 16 |
# File 'lib/laboratory/adapters/mock_adapter.rb', line 14 def read_all experiment_hash.values end |
#write(experiment) ⇒ Object
10 11 12 |
# File 'lib/laboratory/adapters/mock_adapter.rb', line 10 def write(experiment) experiment_hash[experiment.id] = experiment end |