Class: Keela::Strategies::Scopes
- Inherits:
-
Keela::Strategy
- Object
- Keela::Strategy
- Keela::Strategies::Scopes
- Defined in:
- lib/keela/strategies/scopes.rb
Instance Method Summary collapse
- #definition_file_pattern ⇒ Object
- #extract_definition(line) ⇒ Object
- #name ⇒ Object
- #skip_comments? ⇒ Boolean
- #usage_regex(name) ⇒ Object
Instance Method Details
#definition_file_pattern ⇒ Object
10 11 12 |
# File 'lib/keela/strategies/scopes.rb', line 10 def definition_file_pattern %r{app/models} end |
#extract_definition(line) ⇒ Object
14 15 16 17 18 |
# File 'lib/keela/strategies/scopes.rb', line 14 def extract_definition(line) return nil unless line =~ /\bscope\s+:(\w+)/ Regexp.last_match(1) end |
#name ⇒ Object
6 7 8 |
# File 'lib/keela/strategies/scopes.rb', line 6 def name "scopes" end |
#skip_comments? ⇒ Boolean
24 25 26 |
# File 'lib/keela/strategies/scopes.rb', line 24 def skip_comments? true end |
#usage_regex(name) ⇒ Object
20 21 22 |
# File 'lib/keela/strategies/scopes.rb', line 20 def usage_regex(name) /(?<!scope :)(?<!def )#{Regexp.quote(name)}\W/ end |