class ANTLR3::Template::ParameterList

Attributes

block[RW]
splat[RW]

Public Class Methods

default() click to toggle source
# File lib/antlr3/template.rb, line 311
def self.default
  new.add( :values ) do | p |
    p.default = '{}'
  end
end

Public Instance Methods

add( name, options = nil ) { |param| ... } click to toggle source
# File lib/antlr3/template.rb, line 324
def add( name, options = nil )
  param =
    case name
    when Parameter then name
    else Parameter.new( name.to_s )
    end
  if options
    default = options[ :default ] and param.default = default
    param.splat = options.fetch( :splat, false )
    param.block = options.fetch( :block, false )
  end
  block_given? and yield( param )
  push( param )
  return( self )
end
names() click to toggle source
# 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() click to toggle source
# 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