Class: DeadCodeTerminator::Cond::EnvFetch
- Defined in:
- lib/dead_code_terminator/cond/env_fetch.rb
Overview
ENV.fetch(‘PRODUCTION’) s(:send,
s(:const, nil, :ENV), :fetch,
s(:str, "PRODUCTION"))
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from DeadCodeTerminator::Cond::Base
Instance Method Details
#value ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dead_code_terminator/cond/env_fetch.rb', line 10 def value return if ast.type != :send receiver, method, *args = ast.children return unless receiver == s(:const, nil, :ENV) && method == :fetch return unless (matched_env_key = given_env_key(args[0])) env[matched_env_key] ? THEN : ELSE end |