-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move mixins to obsession namespace to avoid conflicts
- Loading branch information
1 parent
baf4f92
commit bfc9360
Showing
4 changed files
with
34 additions
and
32 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
module RuboCop | ||
module Cop | ||
module Obsession | ||
module Helpers | ||
def rails_callback?(callback) | ||
return true if callback == 'validate' | ||
|
||
callback.match?( | ||
/ | ||
^(before|after|around) | ||
_.* | ||
(action|validation|create|update|save|destroy|commit|rollback)$ | ||
/x | ||
) | ||
end | ||
|
||
def verb?(string) | ||
short_string = string[2..] if string.start_with?('re') | ||
|
||
verbs.include?(string) || verbs.include?(short_string) | ||
end | ||
|
||
private | ||
|
||
def verbs | ||
@@verbs ||= File.read("#{__dir__}/files/verbs.txt").split | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters