Class: Rails::Cops::ModelEnumSetting

Inherits:
RuboCop::Cop::Base
  • Object
show all
Defined in:
lib/rails/cops/model_enum_setting.rb

Overview

This is for custom rubocop rule for model enum

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object

event handler



17
18
19
20
21
22
23
# File 'lib/rails/cops/model_enum_setting.rb', line 17

def on_send(node)
  enum_matcher(node) do |matches|
    next if matches.any? { |pair| pair.key.value.to_s.end_with?('_prefix', '_suffix') }

    add_offense(node, message: MSG)
  end
end