class Sorta::Http::Web::Template::Router

Attributes

routes[R]

Public Class Methods

new() click to toggle source
# File lib/sorta/http/web/template/router.rb, line 10
def initialize
  @routes = []
  @prefix = ''
end

Private Instance Methods

namespace(name, &block) click to toggle source
# File lib/sorta/http/web/template/router.rb, line 29
def namespace(name, &block)
  old_prefix = @prefix
  @prefix = with_prefix(name.to_s)
  instance_exec(&block)
ensure
  @prefix = old_prefix
end
with_prefix(path) click to toggle source
# File lib/sorta/http/web/template/router.rb, line 25
def with_prefix(path)
  File.join('/', @prefix, path)
end