Sha256: 2bb91c8159c544bd58502e22134b356d1f58d05810fbc1aeb1b3add9eb1577a8

Contents?: true

Size: 735 Bytes

Versions: 9

Compression:

Stored size: 735 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc
  module Associations #:nodoc
    class Proxy #:nodoc
      instance_methods.each do |method|
        undef_method(method) unless method =~ /(^__|^nil\?$|^send$|^object_id$|^extend$)/
      end
      attr_reader \
        :options,
        :target

      # Default behavior of method missing should be to delegate all calls
      # to the target of the proxy. This can be overridden in special cases.
      def method_missing(name, *args, &block)
        @target.send(name, *args, &block)
      end

      # If anonymous extensions are added this will take care of them.
      def extends(options)
        extend Module.new(&options.extension) if options.extension?
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 4 rubygems

Version Path
mongoid-1.9.5 lib/mongoid/associations/proxy.rb
mongoid-with-auth-1.9.4 lib/mongoid/associations/proxy.rb
mongoid-rails2-1.9.4 lib/mongoid/associations/proxy.rb
mongoid-rails2-1.9.3 lib/mongoid/associations/proxy.rb
mongoid-1.9.2 lib/mongoid/associations/proxy.rb
sskirby-mongoid-1.9.1 lib/mongoid/associations/proxy.rb
mongoid-1.9.1 lib/mongoid/associations/proxy.rb
mongoid-2.0.0.beta.5 lib/mongoid/associations/proxy.rb
mongoid-1.9.0 lib/mongoid/associations/proxy.rb