lib/bindata/io.rb in bindata-1.4.5 vs lib/bindata/io.rb in bindata-1.5.0
- old
+ new
@@ -5,11 +5,11 @@
# interface for BinData objects to use when accessing the IO.
class IO
# Creates a StringIO around +str+.
def self.create_string_io(str = "")
- if RUBY_VERSION >= "1.9"
+ if str.respond_to?(:force_encoding)
str = str.dup.force_encoding(Encoding::BINARY)
end
StringIO.new(str)
end
@@ -17,10 +17,10 @@
# for reading, #write if used for writing, #pos if reading the current
# stream position and #seek if setting the current stream position. If
# +io+ is a string it will be automatically wrapped in an StringIO object.
#
# The IO can handle bitstreams in either big or little endian format.
- #
+ #
# M byte1 L M byte2 L
# S 76543210 S S fedcba98 S
# B B B B
#
# In big endian format: