Sha256: 07b00342bfe2c95a9e266cc747a8e808896a651d6abb97cb2165f46fe4a89b83

Contents?: true

Size: 410 Bytes

Versions: 45

Compression:

Stored size: 410 Bytes

Contents

module Utils
  # JRuby chokes when strings like "\xfe\x00\xff", which are not valid UTF-8,
  # appear in the source. Use this method to build such strings.
  # char_array is an array of byte values to use for the string.
  module_function def make_byte_string(char_array, encoding = 'BINARY')
    char_array.map do |char|
      char.chr.force_encoding('BINARY')
    end.join.force_encoding(encoding)
  end
end

Version data entries

45 entries across 45 versions & 2 rubygems

Version Path
bson-4.9.5 spec/support/utils.rb
bson-4.10.0-java spec/support/utils.rb
bson-4.10.0 spec/support/utils.rb
bson-4.9.4-java spec/support/utils.rb
bson-4.9.4 spec/support/utils.rb
bson-4.9.3-java spec/support/utils.rb
bson-4.9.3 spec/support/utils.rb
bson-4.9.2-java spec/support/utils.rb
bson-4.9.2 spec/support/utils.rb
bson-4.9.1-java spec/support/utils.rb
bson-4.9.1 spec/support/utils.rb
bson-4.9.0-java spec/support/utils.rb
bson-4.9.0 spec/support/utils.rb
bson-4.8.2-java spec/support/utils.rb
bson-4.8.2 spec/support/utils.rb
bson-4.8.1-java spec/support/utils.rb
bson-4.8.1 spec/support/utils.rb
bson-4.8.0-java spec/support/utils.rb
bson-4.8.0 spec/support/utils.rb
bson-4.7.1-java spec/support/utils.rb