module BitGirder::Io::Testing

Public Class Methods

new_string_io( str = "" ) click to toggle source
# File lib/bitgirder/io/testing.rb, line 15
def new_string_io( str = "" )
    RubyVersions.when_19x( StringIO.new( str ) ) do |io|
        io.set_encoding( "binary" )
    end
end
rand_buf( len ) click to toggle source
# File lib/bitgirder/io/testing.rb, line 23
def rand_buf( len )

    len = len.bytes if len.is_a?( DataSize )
    File.open( "/dev/random", "rb" ) { |io| Io.read_full( io, len ) }
end

Private Instance Methods

new_string_io( str = "" ) click to toggle source
# File lib/bitgirder/io/testing.rb, line 15
def new_string_io( str = "" )
    RubyVersions.when_19x( StringIO.new( str ) ) do |io|
        io.set_encoding( "binary" )
    end
end
rand_buf( len ) click to toggle source
# File lib/bitgirder/io/testing.rb, line 23
def rand_buf( len )

    len = len.bytes if len.is_a?( DataSize )
    File.open( "/dev/random", "rb" ) { |io| Io.read_full( io, len ) }
end