Class: ANTLR3::Template::ParameterList
- Inherits:
-
Array
- Object
- Array
- ANTLR3::Template::ParameterList
- Defined in:
- lib/antlr3/template.rb,
lib/antlr3/template/parameter.rb
Instance Attribute Summary (collapse)
-
- (Object) block
Returns the value of attribute block.
-
- (Object) splat
Returns the value of attribute splat.
Class Method Summary (collapse)
Instance Method Summary (collapse)
Methods inherited from Array
Instance Attribute Details
- (Object) block
Returns the value of attribute block
294 295 296 |
# File 'lib/antlr3/template.rb', line 294 def block @block end |
- (Object) splat
Returns the value of attribute splat
294 295 296 |
# File 'lib/antlr3/template.rb', line 294 def splat @splat end |
Class Method Details
+ (Object) default
296 297 298 299 300 |
# File 'lib/antlr3/template.rb', line 296 def self.default new.add( :values ) do | p | p.default = '{}' end end |
Instance Method Details
- (Object) add(name, default = nil)
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/antlr3/template.rb', line 309 def add( name, default = 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 |
- (Object) names
302 303 304 305 306 307 |
# File 'lib/antlr3/template.rb', line 302 def names names = map { | param | param.name.to_s } @splat and names << @splat.to_s @block and names << @block.to_s return( names ) end |
- (Object) to_s
325 326 327 328 329 330 |
# File 'lib/antlr3/template.rb', line 325 def to_s signature = join( ', ' ) @splat and signature << ", *" << @splat.to_s @block and signature << ", &" << @block.to_s return( signature ) end |