Class: ActiveMongoid::Associations::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/active_mongoid/associations/proxy.rb

Direct Known Subclasses

Many, One

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#baseObject

Returns the value of attribute base.



12
13
14
# File 'lib/active_mongoid/associations/proxy.rb', line 12

def base
  @base
end

#targetObject

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

Yields:

  • (_self)

Yield Parameters:



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

#klassObject



25
26
27
# File 'lib/active_mongoid/associations/proxy.rb', line 25

def klass
   ? .klass : nil
end