class RuboCop::Cop::UmtsCustomCops::BeMatcherForNonDuplicableTypes

Prefer the easier-to-read be matcher for non-duplicable types.

See the specs for examples.

Constants

MSG

Public Instance Methods

autocorrect(node) click to toggle source
# File lib/umts-custom-cops/be_matcher_for_non_duplicable_types.rb, line 24
def autocorrect(node)
  lambda do |corrector|
    matcher = node.child_nodes[1]
    corrector.replace matcher.loc.selector, 'be'
  end
end
on_send(node) click to toggle source
# File lib/umts-custom-cops/be_matcher_for_non_duplicable_types.rb, line 31
def on_send(node)
  return unless eq_on_non_duplicable_type? node

  add_offense node, location: :expression, message: MSG
end