Sha256: 9559cff4bc04248b4f3c7b7863c637d97259e013b40cc53def1470001276e271

Contents?: true

Size: 492 Bytes

Versions: 32

Compression:

Stored size: 492 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module Time #:nodoc:
      module Conversions #:nodoc:
        def set(value)
          return nil if value.blank?
          time = ::Time.parse(value.is_a?(::Time) ? value.strftime("%Y-%m-%d %H:%M:%S %Z") : value.to_s)
          time.utc? ? time : time.utc
        end
        def get(value)
          return nil if value.blank?
          ::Time.zone ? value.getlocal : value
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
mongoid-pre-2.0.0.beta1 lib/mongoid/extensions/time/conversions.rb
mongoid-2.0.0.alpha lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.14 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.13 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.12 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.11 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.10 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.9 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.8 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.7 lib/mongoid/extensions/time/conversions.rb
mongoid-pre-2.0.0.pre lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.6 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.5 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.4 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.3 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.2 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.1 lib/mongoid/extensions/time/conversions.rb
mongoid-1.2.0 lib/mongoid/extensions/time/conversions.rb
mongoid-1.1.4 lib/mongoid/extensions/time/conversions.rb
mongoid-1.1.3 lib/mongoid/extensions/time/conversions.rb