Class: RuboCop::Cop::Betterment::SitePrismLoaded

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/betterment/site_prism_loaded.rb

Constant Summary collapse

MSG =
'Use `be_loaded` instead of `be_displayed`'.freeze

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object



17
18
19
20
21
# File 'lib/rubocop/cop/betterment/site_prism_loaded.rb', line 17

def autocorrect(node)
  lambda do |corrector|
    corrector.replace(node.children[2].loc.expression, 'be_loaded')
  end
end

#on_send(node) ⇒ Object



11
12
13
14
15
# File 'lib/rubocop/cop/betterment/site_prism_loaded.rb', line 11

def on_send(node)
  return unless be_displayed_call?(node)

  add_offense(node, location: node.children[2].loc.expression)
end