Module: Ripper::RubyBuilder::Args

Included in:
Ripper::RubyBuilder
Defined in:
lib/ripper/ruby_builder/events/args.rb

Instance Method Summary collapse

Instance Method Details

#on_arg_paren(args) ⇒ Object



9
10
11
12
13
14
# File 'lib/ripper/ruby_builder/events/args.rb', line 9

def on_arg_paren(args)
  args ||= Ruby::ArgsList.new
  args.rdelim ||= pop_token(:@rparen)
  args.ldelim ||= pop_token(:@lparen)
  args
end

#on_args_add(args, arg) ⇒ Object



26
27
28
29
# File 'lib/ripper/ruby_builder/events/args.rb', line 26

def on_args_add(args, arg)
  args << arg
  args
end

#on_args_add_block(args, block) ⇒ Object



16
17
18
19
# File 'lib/ripper/ruby_builder/events/args.rb', line 16

def on_args_add_block(args, block)
  args << Ruby::Arg.new(block, pop_token(:'@&')) if block
  args
end

#on_args_add_star(args, arg) ⇒ Object



21
22
23
24
# File 'lib/ripper/ruby_builder/events/args.rb', line 21

def on_args_add_star(args, arg)
  args << Ruby::Arg.new(arg, pop_token(:'@*', :pass => true))
  args
end

#on_args_newObject



35
36
37
# File 'lib/ripper/ruby_builder/events/args.rb', line 35

def on_args_new
  Ruby::ArgsList.new
end

#on_blockarg(identifier) ⇒ Object



31
32
33
# File 'lib/ripper/ruby_builder/events/args.rb', line 31

def on_blockarg(identifier)
  Ruby::Arg.new(identifier, pop_token(:'@&'))
end

#on_method_add_arg(call, args) ⇒ Object



4
5
6
7
# File 'lib/ripper/ruby_builder/events/args.rb', line 4

def on_method_add_arg(call, args)
  call.arguments = args
  call
end