class Expressr::Route
Public Class Methods
new(options={})
click to toggle source
# File lib/expressr/route.rb, line 3 def initialize(options={}) @router = options[:router] || raise('No router provided') @path = options[:path] || raise('No path provided') end
Public Instance Methods
all(&block)
click to toggle source
# File lib/expressr/route.rb, line 8 def all(&block) @router.add_route(block, path: @path) self end
delete(&block)
click to toggle source
# File lib/expressr/route.rb, line 28 def delete(&block) @router.delete(@path, &block) self end
get(&block)
click to toggle source
# File lib/expressr/route.rb, line 13 def get(&block) @router.get(@path, &block) self end
post(&block)
click to toggle source
# File lib/expressr/route.rb, line 23 def post(&block) @router.post(@path, &block) self end
put(&block)
click to toggle source
# File lib/expressr/route.rb, line 18 def put(&block) @router.put(@path, &block) self end