Exclusive

class
Superclass
Strelka::Router::Default
Extended With
Loggability

Alternative (stricter) router strategy for Strelka::App::Routing plugin.

Examples

class MyApp < Strelka::App
    plugins :routing
    router :exclusive

    # Unlike the default router, this route will *only* respond to
    # a request that matches the app's route with no additional path.
    get '' do
        # ...
    end

end # class MyApp

Public Instance Methods

anchor
add_route( verb, path, route )

Add a route for the specified verb, path, and options that will return action when a request matches them.

# File lib/strelka/router/exclusive.rb, line 40
def add_route( verb, path, route )
        re = Regexp.compile( '^' + path.join('/') + '$' )

        # Make the Hash for the specified HTTP verb if it hasn't been created already
        self.routes[ re ][ verb ] = route
end