Class: Brief::Server::Route
- Inherits:
-
Object
- Object
- Brief::Server::Route
- Defined in:
- lib/brief/server/route.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#briefcase ⇒ Object
readonly
Returns the value of attribute briefcase.
-
#code ⇒ Object
Returns the value of attribute code.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(env, briefcase, options = {}) ⇒ Route
constructor
A new instance of Route.
- #respond ⇒ Object
Constructor Details
#initialize(env, briefcase, options = {}) ⇒ Route
Returns a new instance of Route.
5 6 7 8 9 10 11 12 13 |
# File 'lib/brief/server/route.rb', line 5 def initialize(env, briefcase, ={}) @env = env @request = Rack::Request.new(env) @briefcase = briefcase @prefix = .fetch(:prefix) {"/briefcases/#{ briefcase.folder_name.to_s.parameterize }"} @code = 400 @headers = {} @body = {} end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/brief/server/route.rb', line 3 def body @body end |
#briefcase ⇒ Object (readonly)
Returns the value of attribute briefcase.
2 3 4 |
# File 'lib/brief/server/route.rb', line 2 def briefcase @briefcase end |
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'lib/brief/server/route.rb', line 3 def code @code end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
2 3 4 |
# File 'lib/brief/server/route.rb', line 2 def env @env end |
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/brief/server/route.rb', line 3 def headers @headers end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
2 3 4 |
# File 'lib/brief/server/route.rb', line 2 def prefix @prefix end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
2 3 4 |
# File 'lib/brief/server/route.rb', line 2 def request @request end |
Instance Method Details
#respond ⇒ Object
15 16 17 18 |
# File 'lib/brief/server/route.rb', line 15 def respond status, headers, body = response_data [status, headers, body] end |