module BSON::Date
Injects behaviour for encoding date values to raw bytes as specified by the BSON
spec for time.
@see bsonspec.org/#/specification
@since 2.1.0
Public Instance Methods
bson_type()
click to toggle source
to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
click to toggle source
Get the date as encoded BSON
.
@example Get the date as encoded BSON
.
Date.new(2012, 1, 1).to_bson
@return [ BSON::ByteBuffer
] The buffer with the encoded object.
@see bsonspec.org/#/specification
@since 2.1.0
# File lib/bson/date.rb, line 37 def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?) ::Time.utc(year, month, day).to_bson(buffer) end