Sha256: 12ad3c4b829d31ff1e7f4f9394a74b799d1575012966b4f50e72a0abcc64540b

Contents?: true

Size: 453 Bytes

Versions: 1

Compression:

Stored size: 453 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.to_s)
          time.utc? ? time : time.utc
        end
        def get(value)
          return nil if value.blank?
          ::Time.zone ? ::Time.zone.parse(value.to_s).getlocal : value
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-0.11.8 lib/mongoid/extensions/time/conversions.rb