Sha256: 9010e6c84dd4a92e4352a867c970ae27e2996316a9b4dcfa6f487e9e8cf9aa4f

Contents?: true

Size: 650 Bytes

Versions: 3

Compression:

Stored size: 650 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 InstanceMethods
          # Converts this object to a hash of attributes
          def mongoidize
            self.attributes
          end
        end

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

          def get(value)
            self.new(value)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
mongoid-pre-2.0.0.beta1 lib/mongoid/extensions/object/conversions.rb
mongoid-2.0.0.alpha lib/mongoid/extensions/object/conversions.rb
mongoid-pre-2.0.0.pre lib/mongoid/extensions/object/conversions.rb