Module: RipperRubyParser::SexpHandlers::Methods Private

Defined in:
lib/ripper_ruby_parser/sexp_handlers/methods.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Sexp handers for method definitions and related constructs

Instance Method Summary collapse

Instance Method Details

#process_alias(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



57
58
59
60
61
62
63
# File 'lib/ripper_ruby_parser/sexp_handlers/methods.rb', line 57

def process_alias(exp)
  _, left, right = exp.shift 3

  s(:alias,
    make_method_name_literal(left),
    make_method_name_literal(right))
end

#process_def(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
8
9
10
11
# File 'lib/ripper_ruby_parser/sexp_handlers/methods.rb', line 5

def process_def(exp)
  _, ident, params, body = exp.shift 4
  ident, pos = extract_node_symbol_with_position ident
  params = convert_special_args(process(params))
  with_position(pos,
                s(:defn, ident, params, *method_body(body)))
end

#process_defs(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
18
19
20
21
# File 'lib/ripper_ruby_parser/sexp_handlers/methods.rb', line 13

def process_defs(exp)
  _, receiver, _, method, params, body = exp.shift 6
  params = convert_special_args(process(params))

  s(:defs,
    process(receiver),
    extract_node_symbol(method),
    params, *method_body(body))
end

#process_return(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
# File 'lib/ripper_ruby_parser/sexp_handlers/methods.rb', line 23

def process_return(exp)
  _, arglist = exp.shift 2
  s(:return, handle_return_argument_list(arglist))
end

#process_return0(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
31
# File 'lib/ripper_ruby_parser/sexp_handlers/methods.rb', line 28

def process_return0(exp)
  _ = exp.shift
  s(:return)
end

#process_undef(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ripper_ruby_parser/sexp_handlers/methods.rb', line 43

def process_undef(exp)
  _, args = exp.shift 2

  args.map! do |sub_exp|
    s(:undef, make_method_name_literal(sub_exp))
  end

  if args.size == 1
    args[0]
  else
    s(:block, *args)
  end
end

#process_yield(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
36
# File 'lib/ripper_ruby_parser/sexp_handlers/methods.rb', line 33

def process_yield(exp)
  _, arglist = exp.shift 2
  s(:yield, *handle_argument_list(arglist))
end

#process_yield0(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



38
39
40
41
# File 'lib/ripper_ruby_parser/sexp_handlers/methods.rb', line 38

def process_yield0(exp)
  _ = exp.shift
  s(:yield)
end