Class: SessionSpec::Model::ModelPersistor

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

Constant Summary

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_id

Constructor Details

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

Class Method Details

+ (Object) clear



36
37
38
# File 'spec/persistence/session_spec.rb', line 36

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

+ (Object) register(key, value)



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

def self.register(key, value)
  @@objects[key] =  value
end

Instance Method Details

- (Object) bulk_load(states, *params, &block)



32
33
34
# File 'spec/persistence/session_spec.rb', line 32

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