Sha256: e0917dd02cb69f41027c52fd35a17159b47d7cba04d576d8473438ac5c92df3e

Contents?: true

Size: 354 Bytes

Versions: 41

Compression:

Stored size: 354 Bytes

Contents

class DateTime
  def to_bson(*args)
    {
      MongoDoc::BSON::CLASS_KEY => self.class.name,
      'dt' => strftime,
      'sg' => start
    }
  end

  def self.bson_create(bson_hash, options = nil)
    DateTime.parse(*bson_hash.values_at('dt', 'sg'))
  end

  def self.cast_from_string(string)
    DateTime.parse(string) unless string.blank?
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
mongo_doc-0.6.13 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.12 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.11 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.10 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.9 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.8 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.7 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.6 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.5 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.4 lib/mongo_doc/ext/date_time.rb
mongo_doc_rails2-0.6.2 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.3 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.2 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.1 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.0 lib/mongo_doc/ext/date_time.rb
mongo_doc_rails2-0.6.1 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.5.5 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.4.2 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.4.1 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.4.0 lib/mongo_doc/ext/date_time.rb