Skip to content

Commit

Permalink
Lazy load verbs file
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromedalbert committed Nov 5, 2024
1 parent 84992e3 commit 811f5a2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/rubocop/cop/mixin/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
module RuboCop
module Cop
module Helpers
VERBS = File.read("#{__dir__}/files/verbs.txt").split

def rails_callback?(callback)
return true if callback == 'validate'

Expand All @@ -20,7 +18,13 @@ def rails_callback?(callback)
def verb?(string)
short_string = string[2..] if string.start_with?('re')

VERBS.include?(string) || VERBS.include?(short_string)
verbs.include?(string) || verbs.include?(short_string)
end

private

def verbs
@@verbs ||= File.read("#{__dir__}/files/verbs.txt").split
end
end
end
Expand Down

0 comments on commit 811f5a2

Please sign in to comment.