Class: MongoDoc::Associations::ProxyBase
- Defined in:
- lib/mongodoc/associations/proxy_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#_parent ⇒ Object
Returns the value of attribute _parent.
-
#_root ⇒ Object
Returns the value of attribute _root.
-
#assoc_class ⇒ Object
readonly
Returns the value of attribute assoc_class.
-
#assoc_name ⇒ Object
readonly
Returns the value of attribute assoc_name.
Instance Method Summary collapse
- #_path_to_root(src, attrs) ⇒ Object
- #attach(item) ⇒ Object
-
#initialize(options) ⇒ ProxyBase
constructor
A new instance of ProxyBase.
Constructor Details
#initialize(options) ⇒ ProxyBase
Returns a new instance of ProxyBase.
20 21 22 23 24 25 |
# File 'lib/mongodoc/associations/proxy_base.rb', line 20 def initialize() @assoc_name = [:assoc_name] @assoc_class = [:assoc_class] @_root = [:root] @_parent = [:parent] end |
Instance Attribute Details
#_parent ⇒ Object
Returns the value of attribute _parent.
6 7 8 |
# File 'lib/mongodoc/associations/proxy_base.rb', line 6 def _parent @_parent end |
#_root ⇒ Object
Returns the value of attribute _root.
6 7 8 |
# File 'lib/mongodoc/associations/proxy_base.rb', line 6 def _root @_root end |
#assoc_class ⇒ Object (readonly)
Returns the value of attribute assoc_class.
6 7 8 |
# File 'lib/mongodoc/associations/proxy_base.rb', line 6 def assoc_class @assoc_class end |
#assoc_name ⇒ Object (readonly)
Returns the value of attribute assoc_name.
6 7 8 |
# File 'lib/mongodoc/associations/proxy_base.rb', line 6 def assoc_name @assoc_name end |
Instance Method Details
#_path_to_root(src, attrs) ⇒ Object
12 13 14 |
# File 'lib/mongodoc/associations/proxy_base.rb', line 12 def _path_to_root(src, attrs) _parent._path_to_root(src, annotated_keys(src, attrs)) end |
#attach(item) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/mongodoc/associations/proxy_base.rb', line 27 def attach(item) if is_document?(item) item._parent = self item._root = _root _root.send(:register_save_observer, item) end item end |