Class: TokenParser::Registry
Overview
Registry
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Method Summary collapse
- #each(&yld) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(*tokens) ⇒ Registry
constructor
A new instance of Registry.
- #register(*tokens) ⇒ Object
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
#registry ⇒ Object (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
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 |