Skip to content

Instantly share code, notes, and snippets.

View gpr's full-sized avatar

Grégory Romé gpr

View GitHub Profile
class RouteRecognizer
attr_reader :paths
# To use this inside your app, call:
# `RouteRecognizer.new.initial_path_segments`
# This returns an array, e.g.: ['assets','blog','team','faq','users']
INITIAL_SEGMENT_REGEX = %r{^\/([^\/\(:]+)}
def initialize