Class: ANTLR3::Template::ParameterList
- Defined in:
- lib/antlr3/template.rb,
lib/antlr3/template/parameter.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#splat ⇒ Object
Returns the value of attribute splat.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Array
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
309 310 311 |
# File 'lib/antlr3/template.rb', line 309 def block @block end |
#splat ⇒ Object
Returns the value of attribute splat.
309 310 311 |
# File 'lib/antlr3/template.rb', line 309 def splat @splat end |
Class Method Details
.default ⇒ Object
311 312 313 314 315 |
# File 'lib/antlr3/template.rb', line 311 def self.default new.add( :values ) do | p | p.default = '{}' end end |
Instance Method Details
#add(name, default = nil) ⇒ Object
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/antlr3/template.rb', line 324 def add( name, = nil ) param = case name when Parameter then name else Parameter.new( name.to_s ) end if default = [ :default ] and param.default = default param.splat = .fetch( :splat, false ) param.block = .fetch( :block, false ) end block_given? and yield( param ) push( param ) return( self ) end |
#names ⇒ Object
317 318 319 320 321 322 |
# File 'lib/antlr3/template.rb', line 317 def names names = map { | param | param.name.to_s } @splat and names << @splat.to_s @block and names << @block.to_s return( names ) end |
#to_s ⇒ Object
340 341 342 343 344 345 |
# File 'lib/antlr3/template.rb', line 340 def to_s signature = join( ', ' ) @splat and signature << ", *" << @splat.to_s @block and signature << ", &" << @block.to_s return( signature ) end |