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.15.0-java spec/support/utils.rb
bson-4.15.0 spec/support/utils.rb
bson-4.14.1-java spec/support/utils.rb
bson-4.14.1 spec/support/utils.rb
bson-4.14.0-java spec/support/utils.rb
bson-4.14.0 spec/support/utils.rb
bson-4.13.0-java spec/support/utils.rb
bson-4.13.0 spec/support/utils.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/bson-4.12.0/spec/support/utils.rb
bson-4.12.1-java spec/support/utils.rb
bson-4.12.1 spec/support/utils.rb
bson-4.12.0-java spec/support/utils.rb
bson-4.12.0 spec/support/utils.rb
bson-4.11.1-java spec/support/utils.rb
bson-4.11.1 spec/support/utils.rb
bson-4.11.0-java spec/support/utils.rb
bson-4.11.0 spec/support/utils.rb
bson-4.10.1-java spec/support/utils.rb
bson-4.10.1 spec/support/utils.rb
bson-4.9.5-java spec/support/utils.rb