Class: ShortStack
- Inherits:
-
Pancake::Stack
- Object
- Pancake::Stack
- ShortStack
- Defined in:
- lib/short_stack.rb,
lib/short_stack/controller.rb
Defined Under Namespace
Classes: Controller
Class Method Summary collapse
-
.any(path, opts = {}, &block) ⇒ Object
Matches any method to the route.
- .as(*args) ⇒ Object
- .base_template_name ⇒ Object
-
.delete(path, opts = {}, &block) ⇒ Object
Deletes the resource at a given path.
-
.get(path, opts = {}, &block) ⇒ Object
Gets a resource at a given path.
- .handle_exception(*args, &block) ⇒ Object
- .helpers(&blk) ⇒ Object
- .new_endpoint_instance ⇒ Object
-
.post(path, opts = {}, &block) ⇒ Object
Posts a resource to a given path.
- .provides(*formats) ⇒ Object
-
.publish(*args) ⇒ Object
Marks a method as published.
-
.put(path, opts = {}, &block) ⇒ Object
Puts a resource to a given path.
- .template(*args) ⇒ Object
Class Method Details
.any(path, opts = {}, &block) ⇒ Object
Matches any method to the route
138 139 140 |
# File 'lib/short_stack.rb', line 138 def self.any(path, opts={}, &block) define_published_action(:any, path, opts, block) end |
.as(*args) ⇒ Object
33 34 35 |
# File 'lib/short_stack.rb', line 33 def self.as(*args) self::Controller.as(*args) end |
.base_template_name ⇒ Object
55 56 57 |
# File 'lib/short_stack.rb', line 55 def self.base_template_name self::Controller.base_template_name end |
.delete(path, opts = {}, &block) ⇒ Object
Deletes the resource at a given path
The block should finish with the final result of the action
132 133 134 |
# File 'lib/short_stack.rb', line 132 def self.delete(path, opts = {}, &block) define_published_action(:delete, path, opts, block) end |
.get(path, opts = {}, &block) ⇒ Object
Gets a resource at a given path
The block should finish with the final result of the action
75 76 77 |
# File 'lib/short_stack.rb', line 75 def self.get(path, opts = {}, &block) define_published_action(:get, path, opts, block) end |
.handle_exception(*args, &block) ⇒ Object
42 43 44 |
# File 'lib/short_stack.rb', line 42 def self.handle_exception(*args, &block) self::Controller.handle_exception(*args, &block) end |
.helpers(&blk) ⇒ Object
46 47 48 49 |
# File 'lib/short_stack.rb', line 46 def self.helpers(&blk) m = Module.new(&blk) self::Controller.class_eval{ include m } end |
.new_endpoint_instance ⇒ Object
17 18 19 |
# File 'lib/short_stack.rb', line 17 def self.new_endpoint_instance self::Controller end |
.post(path, opts = {}, &block) ⇒ Object
Posts a resource to a given path
The block should finish with the final result of the action
94 95 96 |
# File 'lib/short_stack.rb', line 94 def self.post(path, opts = {}, &block) define_published_action(:post, path, opts, block) end |
.provides(*formats) ⇒ Object
38 39 40 |
# File 'lib/short_stack.rb', line 38 def self.provides(*formats) self::Controller.provides(*formats) end |
.publish(*args) ⇒ Object
Marks a method as published. This is done implicitly when using the get, post, put, delete methods on a Stacks::Short But can be done explicitly
27 28 29 30 |
# File 'lib/short_stack.rb', line 27 def self.publish(*args) @published = true self::Controller.publish(*args) end |
.put(path, opts = {}, &block) ⇒ Object
Puts a resource to a given path
The block should finish with the final result of the action
113 114 115 |
# File 'lib/short_stack.rb', line 113 def self.put(path, opts = {}, &block) define_published_action(:put, path, opts, block) end |
.template(*args) ⇒ Object
51 52 53 |
# File 'lib/short_stack.rb', line 51 def self.template(*args) self::Controller.template(*args) end |