Class: Moped::BSON::Timestamp
- Defined in:
- lib/moped/bson/timestamp.rb
Overview
A time representation in BSON.
Instance Attribute Summary collapse
-
#increment ⇒ Object
Returns the value of attribute increment.
-
#seconds ⇒ Object
Returns the value of attribute seconds.
Class Method Summary collapse
-
.__bson_load__(io) ⇒ Timestamp
Deserialize the timestamp to an object.
Instance Method Summary collapse
-
#__bson_dump__(io, key) ⇒ Object
Serialize the time to the stream.
Instance Attribute Details
#increment ⇒ Object
Returns the value of attribute increment
5 6 7 |
# File 'lib/moped/bson/timestamp.rb', line 5 def increment @increment end |
#seconds ⇒ Object
Returns the value of attribute seconds
5 6 7 |
# File 'lib/moped/bson/timestamp.rb', line 5 def seconds @seconds end |
Class Method Details
.__bson_load__(io) ⇒ Timestamp
Deserialize the timestamp to an object.
32 33 34 |
# File 'lib/moped/bson/timestamp.rb', line 32 def __bson_load__(io) new(*io.read(8).unpack('l2').reverse) end |
Instance Method Details
#__bson_dump__(io, key) ⇒ Object
Serialize the time to the stream.
16 17 18 |
# File 'lib/moped/bson/timestamp.rb', line 16 def __bson_dump__(io, key) io << [17, key, increment, seconds].pack('cZ*l2') end |