class Rack::Way

Public Class Methods

new() click to toggle source
# File lib/rack-way.rb, line 8
def initialize
  @router = Router.new
end

Public Instance Methods

delete(path, endpoint) click to toggle source
# File lib/rack-way.rb, line 41
def delete(path, endpoint)
  @router.add('DELETE', path, endpoint)
end
draw_app(&block) click to toggle source
# File lib/rack-way.rb, line 12
def draw_app(&block)
  instance_eval(&block)

  @router
end
get(path, endpoint) click to toggle source
# File lib/rack-way.rb, line 33
def get(path, endpoint)
  @router.add('GET', path, endpoint)
end
namespace(name, &block) click to toggle source
# File lib/rack-way.rb, line 18
def namespace(name, &block)
  @router.append_namespace(name)
  instance_eval(&block)

  @router.clear_last_namespace
end
not_found(endpoint) click to toggle source
# File lib/rack-way.rb, line 29
def not_found(endpoint)
  @router.add_not_found(endpoint)
end
patch(path, endpoint) click to toggle source
# File lib/rack-way.rb, line 49
def patch(path, endpoint)
  @router.add('PATCH', path, endpoint)
end
post(path, endpoint) click to toggle source
# File lib/rack-way.rb, line 37
def post(path, endpoint)
  @router.add('POST', path, endpoint)
end
put(path, endpoint) click to toggle source
# File lib/rack-way.rb, line 45
def put(path, endpoint)
  @router.add('PUT', path, endpoint)
end
root(endpoint) click to toggle source
# File lib/rack-way.rb, line 25
def root(endpoint)
  @router.add('GET', '', endpoint)
end