Class: Norma::Record
Overview
Record delegator
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Access the delegate object.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(object) ⇒ Record
constructor
A new instance of Record.
- #persisted! ⇒ Object
-
#persisted? ⇒ Boolean
Is the object persisted in the database?.
-
#reload ⇒ Object
Load.
-
#save ⇒ Object
Save.
- #store ⇒ Object
Constructor Details
#initialize(object) ⇒ Record
Returns a new instance of Record.
18 19 20 |
# File 'lib/norma/orm.rb', line 18 def initialize( object ) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Access the delegate object.
15 16 17 |
# File 'lib/norma/orm.rb', line 15 def object @object end |
Instance Method Details
#id ⇒ Object
28 29 30 |
# File 'lib/norma/orm.rb', line 28 def id @id ||= store.mint_id end |
#persisted! ⇒ Object
34 |
# File 'lib/norma/orm.rb', line 34 def persisted! ; @persisted = true ; end |
#persisted? ⇒ Boolean
Is the object persisted in the database?
33 |
# File 'lib/norma/orm.rb', line 33 def persisted? ; @persisted ; end |
#reload ⇒ Object
Load
37 38 39 |
# File 'lib/norma/orm.rb', line 37 def reload store.load(id, @object) end |
#store ⇒ Object
23 24 25 |
# File 'lib/norma/orm.rb', line 23 def store @object.class.record_store end |