Class: RuboCop::Cop::SketchupPerformance::Typename

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/sketchup/performance/typename.rb

Constant Summary collapse

MSG =
'.typename is very slow, prefer .is_a? instead.'.freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/rubocop/sketchup/performance/typename.rb', line 9

def on_send(node)
  _, method_name = *node
  return unless method_name == :typename
  # TODO(thomthom): Should we try to detect use of #typename
  # in context of comparing against a string?
  add_offense(node, :expression)
end