Class: Keela::Strategies::Scopes

Inherits:
Keela::Strategy show all
Defined in:
lib/keela/strategies/scopes.rb

Instance Method Summary collapse

Instance Method Details

#definition_file_patternObject



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

#nameObject



6
7
8
# File 'lib/keela/strategies/scopes.rb', line 6

def name
  "scopes"
end

#skip_comments?Boolean

Returns:

  • (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