Module: BinData::IO

Defined in:
lib/bindata/io.rb

Overview

A wrapper around an IO object. The wrapper provides a consistent interface for BinData objects to use when accessing the IO.

Defined Under Namespace

Modules: UnSeekableIO Classes: RawIO, Read, Transform, Write

Class Method Summary collapse

Class Method Details

.create_string_io(str = "") ⇒ Object

Creates a StringIO around str.



9
10
11
12
# File 'lib/bindata/io.rb', line 9

def self.create_string_io(str = "")
  bin_str = str.dup.force_encoding(Encoding::BINARY)
  StringIO.new(bin_str).tap(&:binmode)
end