module BSON::TimeWithZone
Injects behaviour for encoding ActiveSupport::TimeWithZone values to raw bytes as specified by the BSON
spec for time.
@see bsonspec.org/#/specification
@since 4.4.0
Public Instance Methods
Source
Source
# File lib/bson/time_with_zone.rb, line 38 def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?) buffer.put_int64((to_i * 1000) + (usec / 1000)) end
Get the ActiveSupport::TimeWithZone as encoded BSON
.
@example Get the ActiveSupport::TimeWithZone as encoded BSON
.
Time.utc(2012, 12, 12, 0, 0, 0).in_time_zone("Pacific Time (US & Canada)").to_bson
@return [ BSON::ByteBuffer
] The buffer with the encoded object.
@see bsonspec.org/#/specification
@since 4.4.0