Class: Firebug::StringIOReader

Inherits:
StringIO
  • Object
show all
Defined in:
lib/firebug/string_io_reader.rb

Instance Method Summary collapse

Instance Method Details

#read_until(char, include: true) ⇒ String?

Reads data from the buffer until char is found.

Parameters:

  • char (String)

    The character to look for.

  • include (Boolean) (defaults to: true)

    If char should be included in the result.

Returns:

  • (String, nil)


10
11
12
13
14
# File 'lib/firebug/string_io_reader.rb', line 10

def read_until(char, include: true)
  if (idx = string.index(char, pos)) # rubocop:disable Style/GuardClause
    read(idx - pos + (include ? 1 : 0))
  end
end