Sha256: 7176d30f2a3c485b85c894aefdc11b3cbd73767313f75413d2fd678daa67ba42

Contents?: true

Size: 305 Bytes

Versions: 10

Compression:

Stored size: 305 Bytes

Contents

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

  alias start sg unless method_defined?(:start)

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

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
mongo_doc-0.3.1 lib/mongo_doc/ext/date.rb
mongo_doc-0.3.0 lib/mongo_doc/ext/date.rb
mongodoc-0.2.4 lib/mongodoc/ext/date.rb
mongodoc-0.2.2 lib/mongodoc/ext/date.rb
mongodoc-0.2.1 lib/mongodoc/ext/date.rb
mongodoc-0.2.0 lib/mongodoc/ext/date.rb
mongodoc-0.1.2 lib/mongodoc/ext/date.rb
mongodoc-0.1.1 lib/mongodoc/ext/date.rb
mongodoc-0.1.0 lib/mongodoc/ext/date.rb
mongodoc-0.0.0 lib/mongodoc/ext/date.rb