Sha256: f91dbd7f782210a6643a14792e362673d3bb738ae872359cb05cd19a6902d4d7

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

# frozen_string_literal: true

module Firebug
  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.0 lib/firebug/string_io_reader.rb