Class: Candies::Server::Base
- Inherits:
-
Object
- Object
- Candies::Server::Base
- Defined in:
- lib/candies/server/base.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
writeonly
Sets the attribute id.
-
#request ⇒ Object
Returns the value of attribute request.
-
#responders ⇒ Object
Returns the value of attribute responders.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(responders = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(responders = {}) ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/candies/server/base.rb', line 6 def initialize(responders = {}) @responders = responders end |
Instance Attribute Details
#id=(value) ⇒ Object
Sets the attribute id
4 5 6 |
# File 'lib/candies/server/base.rb', line 4 def id=(value) @id = value end |
#request ⇒ Object
Returns the value of attribute request.
4 5 6 |
# File 'lib/candies/server/base.rb', line 4 def request @request end |
#responders ⇒ Object
Returns the value of attribute responders.
4 5 6 |
# File 'lib/candies/server/base.rb', line 4 def responders @responders end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 |
# File 'lib/candies/server/base.rb', line 10 def call(env) @request = Rack::Request.new(env) @responders.fetch(format) {@responders[:json]}.call(env) end |