Class: Laboratory::Adapters::MockAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/laboratory/adapters/mock_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMockAdapter

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_hashObject

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_allObject



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_allObject



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