Module: Rack::Putty::Router::ClassMethods
- Defined in:
- lib/rack-putty/router.rb
Instance Method Summary collapse
- #delete(path, opts = {}, &bk) ⇒ Object
-
#get(path, opts = {}, &block) ⇒ Object
Defining a ‘GET` handler also automatically defines a `HEAD` handler.
- #head(path, opts = {}, &bk) ⇒ Object
- #match(path, opts = {}, &bk) ⇒ Object
- #middleware(klass, *args) ⇒ Object
- #mount(klass) ⇒ Object
- #options(path, opts = {}, &bk) ⇒ Object
- #patch(path, opts = {}, &bk) ⇒ Object
- #post(path, opts = {}, &bk) ⇒ Object
- #put(path, opts = {}, &bk) ⇒ Object
- #routes ⇒ Object
- #stack_base(klass) ⇒ Object
Instance Method Details
#delete(path, opts = {}, &bk) ⇒ Object
69 |
# File 'lib/rack-putty/router.rb', line 69 def delete(path, opts={}, &bk) route 'DELETE', path, opts, &bk end |
#get(path, opts = {}, &block) ⇒ Object
Defining a ‘GET` handler also automatically defines a `HEAD` handler.
61 62 63 64 |
# File 'lib/rack-putty/router.rb', line 61 def get(path, opts={}, &block) route('GET', path, opts, &block) route('HEAD', path, opts, &block) end |
#head(path, opts = {}, &bk) ⇒ Object
70 |
# File 'lib/rack-putty/router.rb', line 70 def head(path, opts={}, &bk) route 'HEAD', path, opts, &bk end |
#match(path, opts = {}, &bk) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/rack-putty/router.rb', line 73 def match(path, opts={}, &bk) get(path, opts, &bk) put(path, opts, &bk) post(path, opts, &bk) patch(path, opts, &bk) delete(path, opts, &bk) (path, opts, &bk) end |
#middleware(klass, *args) ⇒ Object
44 45 46 47 |
# File 'lib/rack-putty/router.rb', line 44 def middleware(klass, *args) @middleware ||= [] @middleware << [klass, args] end |
#mount(klass) ⇒ Object
49 50 51 |
# File 'lib/rack-putty/router.rb', line 49 def mount(klass) routes.merge_routes klass.routes.instance_variable_get("@routes") end |
#options(path, opts = {}, &bk) ⇒ Object
71 |
# File 'lib/rack-putty/router.rb', line 71 def (path, opts={}, &bk) route 'OPTIONS', path, opts, &bk end |
#patch(path, opts = {}, &bk) ⇒ Object
68 |
# File 'lib/rack-putty/router.rb', line 68 def patch(path, opts={}, &bk) route 'PATCH', path, opts, &bk end |
#post(path, opts = {}, &bk) ⇒ Object
67 |
# File 'lib/rack-putty/router.rb', line 67 def post(path, opts={}, &bk) route 'POST', path, opts, &bk end |
#put(path, opts = {}, &bk) ⇒ Object
66 |
# File 'lib/rack-putty/router.rb', line 66 def put(path, opts={}, &bk) route 'PUT', path, opts, &bk end |
#routes ⇒ Object
53 54 55 |
# File 'lib/rack-putty/router.rb', line 53 def routes @routes ||= Rack::Mount::RouteSet.new end |
#stack_base(klass) ⇒ Object
40 41 42 |
# File 'lib/rack-putty/router.rb', line 40 def stack_base(klass) @stack_base = klass end |