class ABNF::Stream

Attributes

pos[R]

Public Class Methods

new(s, full = nil, pos = 0) click to toggle source
# File lib/abnf.rb, line 33
def initialize(s, full = nil, pos = 0)
  @s = s
  @full = full.nil? ? s : full
  @pos = pos
end

Public Instance Methods

clip(start) click to toggle source
# File lib/abnf.rb, line 47
def clip(start)
  @full[start...@pos]
end
first() click to toggle source
# File lib/abnf.rb, line 39
def first
  @s[0].ord if @s[0]
end
rest() click to toggle source
# File lib/abnf.rb, line 43
def rest
  Stream.new(@s[1..-1], @full, @pos + 1)
end