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`'

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object



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

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

#on_send(node) ⇒ Object



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

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

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