Class: SimplyStored::Couch::HasOne::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/simply_stored/couch/has_one.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  options = {:dependent => :nullify}.update(options)
  @name, @options = name, options
  
  options.assert_valid_keys(:dependent)
  
  owner_clazz.class_eval do
    define_has_one_getter(name)
    define_has_one_setter(name)
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



53
54
55
# File 'lib/simply_stored/couch/has_one.rb', line 53

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



53
54
55
# File 'lib/simply_stored/couch/has_one.rb', line 53

def options
  @options
end

Instance Method Details

#association?Boolean

Returns:

  • (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

Returns:

  • (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

Returns:

  • (Boolean)


83
84
85
# File 'lib/simply_stored/couch/has_one.rb', line 83

def supports_dirty?
  false
end