Module: Aqua::Unpack::ClassMethods
- Defined in:
- lib/aqua/object/unpack.rb
Instance Method Summary collapse
-
#_get_store(id) ⇒ Storage
private
Retrieves objects storage from its engine.
-
#build(doc, id = nil) ⇒ Object
Creates a new object from the doc; It is used by queries which return a set of docs.
-
#load(id) ⇒ Object
Creates a new object with the class of the base class and loads it with data saved from the database.
Instance Method Details
#_get_store(id) ⇒ Storage
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Retrieves objects storage from its engine.
25 26 27 28 29 |
# File 'lib/aqua/object/unpack.rb', line 25 def _get_store( id ) doc = self::Storage.get( id ) raise ArgumentError, "#{self} with id of #{doc_id} was not found" unless doc doc end |
#build(doc, id = nil) ⇒ Object
Creates a new object from the doc; It is used by queries which return a set of docs. Also used by load to do the same thing …
34 35 36 37 |
# File 'lib/aqua/object/unpack.rb', line 34 def build( doc, id=nil ) translator = Aqua::Translator.new( new, id ) translator.unpack_object( doc ) end |
#load(id) ⇒ Object
Creates a new object with the class of the base class and loads it with data saved from the database.
16 17 18 19 |
# File 'lib/aqua/object/unpack.rb', line 16 def load( id ) doc = _get_store( id ) build( doc, id ) end |