Method: IRB::RubyLex.generate_local_variables_assign_code

Defined in:
lib/irb/ruby-lex.rb

.generate_local_variables_assign_code(local_variables) ⇒ Object



101
102
103
104
105
106
107
# File 'lib/irb/ruby-lex.rb', line 101

def generate_local_variables_assign_code(local_variables)
  # Some reserved words could be a local variable
  # Example: def f(if: 1); binding.irb; end
  # These reserved words should be removed from assignment code
  local_variables -= RESERVED_WORDS
  "#{local_variables.join('=')}=nil;" unless local_variables.empty?
end