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.34 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.33 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.32 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.31 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.30 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.29 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.28 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.27 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.26 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.25 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.23 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.22 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.21 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.20 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.19 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.18 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.17 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.16 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.15 lib/mongo_doc/ext/date_time.rb
mongo_doc-0.6.14 lib/mongo_doc/ext/date_time.rb