Module: Reek::SmellDetectors::NilCheck::NilWhenNodeDetector

Defined in:
lib/reek/smell_detectors/nil_check.rb

Overview

Detect ‘when’ statements that perform a nil check.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.detect(node) ⇒ Object



86
87
88
# File 'lib/reek/smell_detectors/nil_check.rb', line 86

def detect(node)
  node.condition_list.any? { |it| it.type == :nil }
end

Instance Method Details

#detect(node) ⇒ Object (private)



86
87
88
# File 'lib/reek/smell_detectors/nil_check.rb', line 86

def detect(node)
  node.condition_list.any? { |it| it.type == :nil }
end