Class: SessionSpec::Model::ModelPersistor

Inherits:
Lims::Core::Persistence::Persistor show all
Defined in:
spec/persistence/session_spec.rb

Constant Summary collapse

Model =
SessionSpec::Model
@@objects =
{}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Lims::Core::Persistence::Persistor

#[], #bind_state_to_id, #bind_state_to_resource, #bulk_delete, #bulk_delete_raw, #bulk_insert, #bulk_retrieve, #bulk_update, #children, #count, #deletable_children, #deletable_parents, #dirty_key_for, #for_each_in_slice, #id_for, #ids_for, inherited, #initialize, #invalid_resource?, #load_children, #model, #new_from_attributes, #new_object, #object_for, #on_object_load, #parents, #parents_for_attributes, #purge_invalid_object, register_model, #retrieve, #slice, #state_for, #state_for?, #state_for_id

Constructor Details

This class inherits a constructor from Lims::Core::Persistence::Persistor

Class Method Details

.clearObject



38
39
40
# File 'spec/persistence/session_spec.rb', line 38

def self.clear()
  @@objects ={}
end

.register(key, value) ⇒ Object



28
29
30
31
32
# File 'spec/persistence/session_spec.rb', line 28

def self.register(key, value)
  key ||= @@objects.size + 1
  @@objects[key] =  value
  key
end

Instance Method Details

#bulk_load(states, *params, &block) ⇒ Object



34
35
36
# File 'spec/persistence/session_spec.rb', line 34

def bulk_load(states, *params, &block)
  states.map { |state| block.call(@@objects[state.id].attributes.merge(id:state.id)) }
end