12 13 14
# File 'lib/mongo_doc/ext/date.rb', line 12 def self.bson_create(bson_hash, options = nil) Date.parse(*bson_hash.values_at('dt', 'sg')) end
16 17 18
# File 'lib/mongo_doc/ext/date.rb', line 16 def self.cast_from_string(value) Date.parse(value) unless value.blank? end
2 3 4 5 6 7 8
# File 'lib/mongo_doc/ext/date.rb', line 2 def to_bson(*args) { MongoDoc::BSON::CLASS_KEY => self.class.name, 'dt' => strftime, 'sg' => start } end