Class: Pinpoint::Format::TokenList

Inherits:
Array
  • Object
show all
Defined in:
lib/pinpoint/format/token_list.rb

Instance Method Summary collapse

Instance Method Details

#process_each!Object

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



16
17
18
19
20
21
22
# File 'lib/pinpoint/format/token_list.rb', line 16

def process_each!
  while size > 0
    token = delete_at(0)

    yield token
  end
end

#valid?Boolean

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.

Returns:

  • (Boolean)


31
32
33
34
35
# File 'lib/pinpoint/format/token_list.rb', line 31

def valid?
  fail Pinpoint::Format::UnevenNestingError if group_start_count != group_end_count

  true
end