Module: RipperRubyParser::SexpHandlers::Loops Private

Defined in:
lib/ripper_ruby_parser/sexp_handlers/loops.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 loops

Instance Method Summary collapse

Instance Method Details

#process_for(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
27
28
29
30
31
32
33
34
35
# File 'lib/ripper_ruby_parser/sexp_handlers/loops.rb', line 23

def process_for(exp)
  _, var, coll, block = exp.shift 4
  coll = process(coll)
  var = process(var)

  var.sexp_type = :lasgn if var.sexp_type == :lvar
  block = unwrap_nil process(block)
  if block
    s(:for, coll, var, block)
  else
    s(:for, coll, var)
  end
end

#process_until(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.



7
8
9
# File 'lib/ripper_ruby_parser/sexp_handlers/loops.rb', line 7

def process_until(exp)
  handle_conditional_loop :until, :while, exp
end

#process_until_mod(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.



11
12
13
# File 'lib/ripper_ruby_parser/sexp_handlers/loops.rb', line 11

def process_until_mod(exp)
  handle_conditional_loop_mod :until, :while, exp
end

#process_while(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.



15
16
17
# File 'lib/ripper_ruby_parser/sexp_handlers/loops.rb', line 15

def process_while(exp)
  handle_conditional_loop :while, :until, exp
end

#process_while_mod(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.



19
20
21
# File 'lib/ripper_ruby_parser/sexp_handlers/loops.rb', line 19

def process_while_mod(exp)
  handle_conditional_loop_mod :while, :until, exp
end