Module: RuboCop::Cop::Helpers
- Included in:
- Obsession::Graphql::MutationName, Obsession::MethodOrder, Obsession::Rails::CallbackOneMethod, Obsession::Rails::PrivateCallback, Obsession::Rails::ServiceName
- Defined in:
- lib/rubocop/cop/mixin/helpers.rb
Instance Method Summary collapse
Instance Method Details
#rails_callback?(callback) ⇒ Boolean
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rubocop/cop/mixin/helpers.rb', line 6 def rails_callback?(callback) return true if callback == 'validate' callback.match?( / ^(before|after|around) _.* (action|validation|create|update|save|destroy|commit|rollback)$ /x ) end |
#verb?(string) ⇒ Boolean
18 19 20 21 22 |
# File 'lib/rubocop/cop/mixin/helpers.rb', line 18 def verb?(string) short_string = string[2..] if string.start_with?('re') verbs.include?(string) || verbs.include?(short_string) end |