Sha256: 0a05412e1ad31c0f3deaabf26be60843f845b6f247ba592122a85aa0a3ece314

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

# frozen_string_literal: true

module Firebug
  # Class for reading a string
  class StringIOReader < StringIO
    # Reads data from the buffer until +char+ is found.
    #
    # @param [String] char The character to look for.
    # @param [Boolean] include If +char+ should be included in the result.
    # @return [String, nil]
    def read_until(char, include: true)
      if (idx = string.index(char, pos)) # rubocop:disable Style/GuardClause
        read(idx - pos + (include ? 1 : 0))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
firebug-1.2.1 lib/firebug/string_io_reader.rb