Module: RipperRubyParser::SexpHandlers::Assignment Private
- Defined in:
- lib/ripper_ruby_parser/sexp_handlers/assignment.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 handlers for assignments
Instance Method Summary collapse
- #process_assign(exp) ⇒ Object private
- #process_massign(exp) ⇒ Object private
- #process_mlhs_add_post(exp) ⇒ Object private
- #process_mlhs_add_star(exp) ⇒ Object private
- #process_mlhs_paren(exp) ⇒ Object private
- #process_mrhs_add_star(exp) ⇒ Object private
- #process_mrhs_new_from_args(exp) ⇒ Object private
- #process_opassign(exp) ⇒ Object private
Instance Method Details
#process_assign(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 12 13 14 15 16 17 18 19 |
# File 'lib/ripper_ruby_parser/sexp_handlers/assignment.rb', line 5 def process_assign(exp) _, lvalue, value = exp.shift 3 lvalue = process(lvalue) value = process(value) case value.sexp_type when :mrhs value.sexp_type = :svalue when :fake_array value = s(:svalue, s(:array, *value.sexp_body)) end with_line_number(lvalue.line, create_regular_assignment_sub_type(lvalue, value)) end |
#process_massign(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.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ripper_ruby_parser/sexp_handlers/assignment.rb', line 21 def process_massign(exp) _, left, right = exp.shift 3 left = process left left = left[1] if left.sexp_type == :masgn left = create_multiple_assignment_sub_types left.sexp_body right = process(right) case right.sexp_type when :fake_array right[0] = :array when :mrhs right = right[1] else right = s(:to_ary, right) end s(:masgn, s(:array, *left), right) end |
#process_mlhs_add_post(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.
60 61 62 63 |
# File 'lib/ripper_ruby_parser/sexp_handlers/assignment.rb', line 60 def process_mlhs_add_post(exp) _, base, rest = exp.shift 3 process(base).push(*process(rest).sexp_body) end |
#process_mlhs_add_star(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.
54 55 56 57 58 |
# File 'lib/ripper_ruby_parser/sexp_handlers/assignment.rb', line 54 def process_mlhs_add_star(exp) _, args, splatarg = exp.shift 3 items = process args items << s(:splat, process(splatarg)) end |
#process_mlhs_paren(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.
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ripper_ruby_parser/sexp_handlers/assignment.rb', line 65 def process_mlhs_paren(exp) _, contents = exp.shift 2 items = process(contents) if items.sexp_type == :mlhs s(:masgn, s(:array, *create_multiple_assignment_sub_types(items.sexp_body))) else items end end |
#process_mrhs_add_star(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.
50 51 52 |
# File 'lib/ripper_ruby_parser/sexp_handlers/assignment.rb', line 50 def process_mrhs_add_star(exp) generic_add_star exp end |
#process_mrhs_new_from_args(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 |
# File 'lib/ripper_ruby_parser/sexp_handlers/assignment.rb', line 43 def process_mrhs_new_from_args(exp) _, inner, last = exp.shift 3 inner = map_process_sexp_body_compact(inner) inner.push process(last) if last s(:fake_array, *inner) end |
#process_opassign(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.
77 78 79 80 81 82 83 84 85 |
# File 'lib/ripper_ruby_parser/sexp_handlers/assignment.rb', line 77 def process_opassign(exp) _, lvalue, operator, value = exp.shift 4 lvalue = process(lvalue) value = process(value) operator = operator[1].delete('=').to_sym create_operator_assignment_sub_type lvalue, value, operator end |