Class: Mongoid::Associations::Proxy

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

Overview

:nodoc

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

Default behavior of method missing should be to delegate all calls to the target of the proxy. This can be overridden in special cases.



14
15
16
# File 'lib/mongoid/associations/proxy.rb', line 14

def method_missing(name, *args, &block)
  @target.send(name, *args, &block)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/mongoid/associations/proxy.rb', line 8

def options
  @options
end

#targetObject (readonly)

Returns the value of attribute target.



8
9
10
# File 'lib/mongoid/associations/proxy.rb', line 8

def target
  @target
end

Instance Method Details

#extends(options) ⇒ Object

If anonymous extensions are added this will take care of them.



19
20
21
# File 'lib/mongoid/associations/proxy.rb', line 19

def extends(options)
  extend Module.new(&options.extension) if options.extension?
end