Class: CustomCops::NoForegroundIndices
- Inherits:
-
RuboCop::Cop::Base
- Object
- RuboCop::Cop::Base
- CustomCops::NoForegroundIndices
- Defined in:
- lib/simplycop/custom_cops/no_foreground_indices.rb
Overview
This cop checks for the presence of Mongoid indexes that have not been
flagged with the flag `background: true`.
Constant Summary collapse
- MSG =
'Do not create indices that lack the background flag.'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
32 33 34 35 36 |
# File 'lib/simplycop/custom_cops/no_foreground_indices.rb', line 32 def on_send(node) model_index?(node) do |_fields, | add_offense(node.loc.selector) unless background_enabled?() end end |