Sha256: 72c07cbc3f2bc6884626fc3e69e6627bd737e39015631397bfa1089480f10dff

Contents?: true

Size: 591 Bytes

Versions: 2

Compression:

Stored size: 591 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module Object #:nodoc:
      # This module converts objects into mongoid related objects.
      module Conversions #:nodoc:
        extend ActiveSupport::Concern

        module ClassMethods
          def set(value)
            value.respond_to?(:attributes) ? value.attributes : value
          end

          def get(value)
            if value && respond_to?(:instantiate)
              instantiate(value)
            else
              value
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mongoid-braxton-2.0.2 lib/mongoid/extensions/object/conversions.rb
mongoid-2.0.2 lib/mongoid/extensions/object/conversions.rb