Sha256: 9cfedd272b449e84080455b3f7c6d669833128fafddc707b4f3fe9891fd44449

Contents?: true

Size: 991 Bytes

Versions: 123

Compression:

Stored size: 991 Bytes

Contents

# encoding: utf-8
module Mongoid # :nodoc:
  module Relations #:nodoc:

    # This is the superclass for one to one relations and defines the common
    # behaviour or those proxies.
    class One < Proxy

      # Get all the documents in the relation that are loaded into memory.
      #
      # @example Get the in memory documents.
      #   relation.in_memory
      #
      # @return [ Array<Document> ] The documents in memory.
      #
      # @since 2.1.0
      def in_memory
        [ target ]
      end

      # Since method_missing is overridden we should override this as well.
      #
      # @example Does the proxy respond to the method?
      #   relation.respond_to?(:name)
      #
      # @param [ Symbol ] name The method name.
      #
      # @return [ true, false ] If the proxy responds to the method.
      #
      # @since 2.1.8
      def respond_to?(name, include_private = false)
        target.respond_to?(name, include_private) || super
      end
    end
  end
end

Version data entries

123 entries across 77 versions & 4 rubygems

Version Path
classiccms-0.5.13 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb
classiccms-0.5.13 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.12 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.12 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb
classiccms-0.5.11 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.11 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb
classiccms-0.5.10 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb
classiccms-0.5.10 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.9 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb
classiccms-0.5.9 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.8 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.8 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb
classiccms-0.5.7 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.7 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb
classiccms-0.5.6 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.6 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb
classiccms-0.5.5 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.5 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb
classiccms-0.5.2 vendor/bundle/gems/mongoid-2.4.7/lib/mongoid/relations/one.rb
classiccms-0.5.2 vendor/bundle/gems/mongoid-2.4.9/lib/mongoid/relations/one.rb