Module: RandomReadIO

Defined in:
lib/block_cipher_kit/io_types.rb

Overview

Used as a stand-in for any IO-ish that responds to ‘#read`, `#seek`, `#pos` and `#size` This module is defined for YARD docs so that Sorbet has a proper type definition.

Instance Method Summary collapse

Instance Method Details

#posInteger

Returns current position in the IO.

Returns:

  • (Integer)

    current position in the IO



24
25
# File 'lib/block_cipher_kit/io_types.rb', line 24

def pos
end

#read(n) ⇒ String?

Returns a String in binary encoding or nil.

Parameters:

  • n (Integer)

    how many bytes to read from the IO

Returns:

  • (String, nil)

    a String in binary encoding or nil



15
16
# File 'lib/block_cipher_kit/io_types.rb', line 15

def read(n)
end

#seek(to_absolute_offset) ⇒ 0

Parameters:

  • to_absolute_offset (Integer)

    the absolute offset in the IO to seek to

Returns:

  • (0)


20
21
# File 'lib/block_cipher_kit/io_types.rb', line 20

def seek(to_absolute_offset)
end

#sizeInteger

Returns the total size of the data in the IO.

Returns:

  • (Integer)

    the total size of the data in the IO



28
29
# File 'lib/block_cipher_kit/io_types.rb', line 28

def size
end