Class: ActiveMongoid::Associations::Proxy
- Inherits:
-
Object
- Object
- ActiveMongoid::Associations::Proxy
- Defined in:
- lib/active_mongoid/associations/proxy.rb
Instance Attribute Summary collapse
-
#__metadata__ ⇒ Object
Returns the value of attribute __metadata__.
-
#base ⇒ Object
Returns the value of attribute base.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #init(base, target, metadata) {|_self| ... } ⇒ Object
- #klass ⇒ Object
- #method_missing(name, *args, &block) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
21 22 23 |
# File 'lib/active_mongoid/associations/proxy.rb', line 21 def method_missing(name, *args, &block) target.send(name, *args, &block) end |
Instance Attribute Details
#__metadata__ ⇒ Object
Returns the value of attribute __metadata__.
12 13 14 |
# File 'lib/active_mongoid/associations/proxy.rb', line 12 def @__metadata__ end |
#base ⇒ Object
Returns the value of attribute base.
12 13 14 |
# File 'lib/active_mongoid/associations/proxy.rb', line 12 def base @base end |
#target ⇒ Object
Returns the value of attribute target.
12 13 14 |
# File 'lib/active_mongoid/associations/proxy.rb', line 12 def target @target end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/active_mongoid/associations/proxy.rb', line 29 def ==(other) # return false unless other # return true if target.object_id == other.object_id # return true if target.attributes == other.attributes target == other end |
#init(base, target, metadata) {|_self| ... } ⇒ Object
14 15 16 17 18 19 |
# File 'lib/active_mongoid/associations/proxy.rb', line 14 def init(base, target, ) @base = base @target = target @__metadata__ = yield(self) if block_given? end |
#klass ⇒ Object
25 26 27 |
# File 'lib/active_mongoid/associations/proxy.rb', line 25 def klass ? .klass : nil end |