Class: Mongo::Protocol::CachingHash Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/mongo/protocol/caching_hash.rb |
Overview
A Hash that caches the results of #to_bson.
Class Method Summary
- .new(hash) ⇒ CachingHash constructor Internal use only
Instance Method Summary
- #bson_type Internal use only
-
#to_bson(buffer = BSON::ByteBuffer.new, validating_keys = nil) ⇒ BSON::ByteBuffer
Internal use only
Caches the result of to_bson and writes it to the given buffer on subsequent calls to this method.
Instance Method Details
#bson_type
[ GitHub ]# File 'lib/mongo/protocol/caching_hash.rb', line 30
def bson_type Hash::BSON_TYPE end
#to_bson(buffer = BSON::ByteBuffer.new, validating_keys = nil) ⇒ BSON::ByteBuffer
Caches the result of to_bson and writes it to the given buffer on subsequent calls to this method. If this method is originally called without validation, and then is subsequently called with validation, we will want to recalculate the to_bson to trigger the validations.