Class: Galago::Router::DSL
- Inherits:
-
Object
- Object
- Galago::Router::DSL
- Defined in:
- lib/galago/router/dsl.rb
Instance Method Summary collapse
- #delete(path, options) ⇒ Object
- #get(path, options) ⇒ Object
-
#initialize(router, block) ⇒ DSL
constructor
A new instance of DSL.
- #namespace(new_namespace) ⇒ Object
- #patch(path, options) ⇒ Object
- #post(path, options) ⇒ Object
- #put(path, options) ⇒ Object
Constructor Details
#initialize(router, block) ⇒ DSL
Returns a new instance of DSL.
4 5 6 7 8 |
# File 'lib/galago/router/dsl.rb', line 4 def initialize(router, block) @router = router @namespace = '' instance_eval(&block) end |
Instance Method Details
#delete(path, options) ⇒ Object
33 34 35 |
# File 'lib/galago/router/dsl.rb', line 33 def delete(path, ) add_route("DELETE", path, [:to]) end |
#get(path, options) ⇒ Object
16 17 18 19 |
# File 'lib/galago/router/dsl.rb', line 16 def get(path, ) add_route("GET", path, [:to]) add_route("HEAD", path, Rack::Head.new([:to])) end |
#namespace(new_namespace) ⇒ Object
10 11 12 13 14 |
# File 'lib/galago/router/dsl.rb', line 10 def namespace(new_namespace) @namespace << "/#{new_namespace}" yield @namespace = '' end |
#patch(path, options) ⇒ Object
21 22 23 |
# File 'lib/galago/router/dsl.rb', line 21 def patch(path, ) add_route("PATCH", path, [:to]) end |
#post(path, options) ⇒ Object
25 26 27 |
# File 'lib/galago/router/dsl.rb', line 25 def post(path, ) add_route("POST", path, [:to]) end |
#put(path, options) ⇒ Object
29 30 31 |
# File 'lib/galago/router/dsl.rb', line 29 def put(path, ) add_route("PUT", path, [:to]) end |