Method: Jets::Router#all_paths

Defined in:
lib/jets/router.rb

#all_pathsObject

Useful for creating API Gateway Resources



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/jets/router.rb', line 42

def all_paths
  results = []
  paths = routes.map(&:path)
  paths.each do |p|
    sub_paths = []
    parts = p.split('/')
    until parts.empty?
      parts.pop
      sub_path = parts.join('/')
      sub_paths << sub_path unless sub_path == ''
    end
    results += sub_paths
  end
  @all_paths = (results + paths).sort.uniq
end