Class: TokenParser::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/mega/tokenparser.rb

Overview

Registry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*tokens) ⇒ Registry

Returns a new instance of Registry.



290
291
292
293
# File 'lib/mega/tokenparser.rb', line 290

def initialize( *tokens )
  @registry = []
  register( *tokens )
end

Instance Attribute Details

#registryObject (readonly)

Returns the value of attribute registry.



288
289
290
# File 'lib/mega/tokenparser.rb', line 288

def registry
  @registry
end

Instance Method Details

#each(&yld) ⇒ Object



307
308
309
# File 'lib/mega/tokenparser.rb', line 307

def each( &yld )
  registry.each( &yld )
end

#empty?Boolean

Returns:

  • (Boolean)


305
# File 'lib/mega/tokenparser.rb', line 305

def empty? ; @registry.empty? ; end

#register(*tokens) ⇒ Object



295
296
297
298
299
300
301
302
303
# File 'lib/mega/tokenparser.rb', line 295

def register( *tokens )
  tokens.each { |tkn|
    unless TokenParser::Token === tkn or TokenParser::UnitToken === tkn
      raise( ArgumentError, "#{tkn.inspect} is not a TokenParser::Token" )
    end
  }
  @registry.concat( tokens )
  #@sorted = false
end