lib/bson/code_with_scope.rb
# Encode the javascript code with scope.
#
# @example Encode the code with scope.
#   code_with_scope.to_bson
#
# @return [ String ] The encoded string.
#
# @see http://bsonspec.org/#/specification
#
# @since 2.0.0
Encode the javascript code with scope.
Encode the javascript code with scope .
def to_bson(encoded = ''.force_encoding(BINARY))
      out = encode_with_placeholder_and_null(BSON_ADJUST - 1, encoded) do |encoded|
        javascript.to_bson(encoded)
        scope.to_bson(encoded)
      end
      out.chop!
    end
def to_bson ( encoded = '' . force_encoding ( BINARY ) ) out = encode_with_placeholder_and_null ( BSON_ADJUST - 1 , encoded ) do | encoded | javascript . to_bson ( encoded ) scope . to_bson ( encoded ) end out . chop! end
Encode the javascript code with scope.
Encode the javascript code with scope .
# -1 because we are removing an extra byte # an extra null byte has been added; we must remove it
The encoded string.
The encoded string .
 String 
encoded
force_encoding
example
Encode the code with scope.
Encode the code with scope .
see
None
since
None