class Pinpoint::Format::TokenList

Public Instance Methods

process_each!() { |token| ... } click to toggle source

Public: Processes each item in the list by removing it and passing it to the block.

At the end of the call, the list will be empty.

Yields the Token of the iteration

Returns nothing

# File lib/pinpoint/format/token_list.rb, line 16
def process_each!
  while size > 0
    token = delete_at(0)

    yield token
  end
end
valid?() click to toggle source

Public: Verifies that the tokens in the list are in good form.

Returns TrueClass if the tokens in the list are valid Raises Pinpoint::Format::UnevenNestingError if the number of

'group_start' tokens does not match the number of 'group_end' tokens.
# File lib/pinpoint/format/token_list.rb, line 31
def valid?
  fail Pinpoint::Format::UnevenNestingError if group_start_count != group_end_count

  true
end

Private Instance Methods

group_end_count() click to toggle source
# File lib/pinpoint/format/token_list.rb, line 43
def group_end_count
  count { |token| token.type == :group_end }
end
group_start_count() click to toggle source
# File lib/pinpoint/format/token_list.rb, line 39
def group_start_count
  count { |token| token.type == :group_start }
end