Class: RuboCop::Yast::Builtins::Getenv

Inherits:
Builtin
  • Object
show all
Defined in:
lib/rubocop/yast/builtins/getenv.rb

Overview

getenv() convertor

Constant Summary

Constants inherited from Builtin

Builtin::ALLOWED_FUNCTIONS

Instance Method Summary collapse

Methods inherited from Builtin

#offense?

Instance Method Details

#correction(node) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/rubocop/yast/builtins/getenv.rb', line 9

def correction(node)
  lambda do |corrector|
    _builtins, _message, *args = *node
    new_code = "ENV[#{args.first.loc.expression.source}]"
    corrector.replace(node.loc.expression, new_code)
  end
end