Class: SimplyStored::Couch::HasOne::Property
- Inherits:
-
Object
- Object
- SimplyStored::Couch::HasOne::Property
- Defined in:
- lib/simply_stored/couch/has_one.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #association? ⇒ Boolean
- #build(object, json) ⇒ Object
- #destroy(object) ⇒ Object
- #dirty?(object) ⇒ Boolean
-
#initialize(owner_clazz, name, options = {}) ⇒ Property
constructor
A new instance of Property.
- #save(object) ⇒ Object
- #serialize(json, object) ⇒ Object
- #supports_dirty? ⇒ Boolean
Constructor Details
#initialize(owner_clazz, name, options = {}) ⇒ Property
Returns a new instance of Property.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/simply_stored/couch/has_one.rb', line 55 def initialize(owner_clazz, name, = {}) = {:dependent => :nullify}.update() @name, @options = name, .assert_valid_keys(:dependent) owner_clazz.class_eval do define_has_one_getter(name) define_has_one_setter(name) end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
53 54 55 |
# File 'lib/simply_stored/couch/has_one.rb', line 53 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
53 54 55 |
# File 'lib/simply_stored/couch/has_one.rb', line 53 def @options end |
Instance Method Details
#association? ⇒ Boolean
87 88 89 |
# File 'lib/simply_stored/couch/has_one.rb', line 87 def association? true end |
#build(object, json) ⇒ Object
77 78 |
# File 'lib/simply_stored/couch/has_one.rb', line 77 def build(object, json) end |
#destroy(object) ⇒ Object
74 75 |
# File 'lib/simply_stored/couch/has_one.rb', line 74 def destroy(object) end |
#dirty?(object) ⇒ Boolean
70 71 72 |
# File 'lib/simply_stored/couch/has_one.rb', line 70 def dirty?(object) false end |
#save(object) ⇒ Object
67 68 |
# File 'lib/simply_stored/couch/has_one.rb', line 67 def save(object) end |
#serialize(json, object) ⇒ Object
80 81 |
# File 'lib/simply_stored/couch/has_one.rb', line 80 def serialize(json, object) end |
#supports_dirty? ⇒ Boolean
83 84 85 |
# File 'lib/simply_stored/couch/has_one.rb', line 83 def supports_dirty? false end |