lib/bson/string.rb
# Get the string as encoded BSON.
#
# @example Get the string as encoded BSON.
#   "test".to_bson
#
# @raise [ EncodingError ] If the string is not UTF-8.
#
# @return [ String ] The encoded string.
#
# @see http://bsonspec.org/#/specification
#
# @since 2.0.0
Get the string as encoded BSON.
Get the string as encoded BSON .
def to_bson(encoded = ''.force_encoding(BINARY))
      encode_with_placeholder_and_null(STRING_ADJUST, encoded) do |encoded|
        to_bson_string(encoded)
      end
    end
def to_bson ( encoded = '' . force_encoding ( BINARY ) ) encode_with_placeholder_and_null ( STRING_ADJUST , encoded ) do | encoded | to_bson_string ( encoded ) end end
Get the string as encoded BSON.
Get the string as encoded BSON .
The encoded string.
The encoded string .
 String 
[ EncodingError ] If the string is not UTF-8.
[ EncodingError ] If the string is not UTF - 8 .
encoded
force_encoding
example
Get the string as encoded BSON. "test".to_bson
Get the string as encoded BSON . " test " . to_bson
see
None
since
None