Class: Cubic::CubicController
- Inherits:
-
Object
- Object
- Cubic::CubicController
- Extended by:
- Logable
- Defined in:
- lib/cubic/application/controller.rb
Overview
All classes generated by Cubic inherit from CubicController
Class Attribute Summary collapse
-
.namespace(name, &b) ⇒ Object
Allows for namespacing within controllers who inherit from CubicController.
Class Method Summary collapse
- .delete(url, &block) ⇒ Object
- .get(url, &block) ⇒ Object
- .namespace_url(url) ⇒ Object
- .post(url, &block) ⇒ Object
- .put(url, &block) ⇒ Object
- .route_setter(request_method, url, block) ⇒ Object
Methods included from Logable
Class Attribute Details
.namespace(name, &b) ⇒ Object
Allows for namespacing within controllers who inherit from CubicController
11 12 13 |
# File 'lib/cubic/application/controller.rb', line 11 def namespace @namespace end |
Class Method Details
.delete(url, &block) ⇒ Object
34 35 36 37 |
# File 'lib/cubic/application/controller.rb', line 34 def delete(url, &block) namespace_url(url) if @namespace route_setter('DELETE', url, block) end |
.get(url, &block) ⇒ Object
18 19 20 21 22 |
# File 'lib/cubic/application/controller.rb', line 18 def get(url, &block) namespace_url(url) if @namespace url[0] == '/' ? url : url.prepend('/') route_setter('GET', url, block) end |
.namespace_url(url) ⇒ Object
43 44 45 |
# File 'lib/cubic/application/controller.rb', line 43 def namespace_url(url) url.prepend(@namespace + '/') end |
.post(url, &block) ⇒ Object
24 25 26 27 |
# File 'lib/cubic/application/controller.rb', line 24 def post(url, &block) namespace_url(url) if @namespace route_setter('POST', url, block) end |
.put(url, &block) ⇒ Object
29 30 31 32 |
# File 'lib/cubic/application/controller.rb', line 29 def put(url, &block) namespace_url(url) if @namespace route_setter('PUT', url, block) end |