Sha256: 911298303351ab2faa67f5628af5c6d918fa45ad8b8f2f24e065de1773d6e699
Contents?: true
Size: 949 Bytes
Versions: 1
Compression:
Stored size: 949 Bytes
Contents
module Galago class Router class DSL def initialize(router, block) @router = router @namespace = '' instance_eval(&block) end def namespace(new_namespace) @namespace << "/#{new_namespace}" yield @namespace = '' end def get(path, options) add_route("GET", path, options[:to]) end def patch(path, options) add_route("PATCH", path, options[:to]) end def post(path, options) add_route("POST", path, options[:to]) end def put(path, options) add_route("PUT", path, options[:to]) end def delete(path, options) add_route("DELETE", path, options[:to]) end private def add_route(method, path, application) path_with_namespace = Path.join(@namespace, path) @router.add_route(method, path_with_namespace, application) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
galago-router-0.1.1 | lib/galago/router/dsl.rb |