Class: Wallaby::ResourcesRegexp

Inherits:
Object
  • Object
show all
Defined in:
lib/routes/wallaby/resources_regexp.rb

Direct Known Subclasses

IdRegexp

Instance Method Summary collapse

Instance Method Details

#executeObject

This method works with Map.id_regexp to complete the constraint restriction in ‘config/routes.rb`. This regular expression matches all the possible resources names that are loaded from the mode_map

It looks like ‘(products|orders|order/items|…)`



9
10
11
12
13
# File 'lib/routes/wallaby/resources_regexp.rb', line 9

def execute
  Regexp.new(<<~REGEXP, Regexp::EXTENDED)
    (#{resources_sources.join('|')}) # all the possible resources names
  REGEXP
end