Skip to content

Instantly share code, notes, and snippets.

@h3h h3h/routes.rb

Last active Aug 29, 2015
What would you like to do?
Getting the first segments of currently defined static routes
map { |r| r.optimized_path[1..-1].split('/').first }.
reject { |s| s.include?('*') || s.include?(':') }

This comment has been minimized.

Copy link
Owner Author

h3h commented Apr 22, 2014

Example output:

=> ["admins", "home", "about", "privacy", "terms", "unsubscribe", "404", "500", "feed",
    "invite", "join", "sign-in", "sign-out", "account", "users", "rails"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.