lib/bson/hash.rb
def to_bson(encoded = ''.force_encoding(BINARY))
      encode_with_placeholder_and_null(BSON_ADJUST, encoded) do |encoded|
        each do |field, value|
          encoded << value.bson_type
          field.to_bson_key(encoded)
          value.to_bson(encoded)
        end
      end
    end
# Get the hash as encoded BSON.
#
# @example Get the hash as encoded BSON.
#   { "field" => "value" }.to_bson
#
# @return [ String ] The encoded string.
#
# @see http://bsonspec.org/#/specification
#
# @since 2.0.0
Get the hash as encoded BSON.
Get the hash as encoded BSON .
def to_bson(encoded = ''.force_encoding(BINARY))
      encode_with_placeholder_and_null(BSON_ADJUST, encoded) do |encoded|
        each do |field, value|
          encoded << value.bson_type
          field.to_bson_key(encoded)
          value.to_bson(encoded)
        end
      end
    end
def to_bson ( encoded = '' . force_encoding ( BINARY ) ) encode_with_placeholder_and_null ( BSON_ADJUST , encoded ) do | encoded | each do | field , value | encoded << value . bson_type field . to_bson_key ( encoded ) value . to_bson ( encoded ) end end end
Get the hash as encoded BSON.
Get the hash as encoded BSON .
The encoded string.
The encoded string .
 String 
encoded
force_encoding
example
Get the hash as encoded BSON.
Get the hash as encoded BSON .
see
None
since
None