Class: Sinatra::Hat::Response
Overview
Tells Sinatra what to do next.
Instance Attribute Summary collapse
-
#maker ⇒ Object
readonly
Returns the value of attribute maker.
Instance Method Summary collapse
-
#initialize(maker, request) ⇒ Response
constructor
A new instance of Response.
- #redirect(*args) ⇒ Object
- #render(action) ⇒ Object
Constructor Details
#initialize(maker, request) ⇒ Response
Returns a new instance of Response.
11 12 13 14 |
# File 'lib/sinatras-hat/response.rb', line 11 def initialize(maker, request) @maker = maker @request = request end |
Instance Attribute Details
#maker ⇒ Object (readonly)
Returns the value of attribute maker.
7 8 9 |
# File 'lib/sinatras-hat/response.rb', line 7 def maker @maker end |
Instance Method Details
#redirect(*args) ⇒ Object
24 25 26 |
# File 'lib/sinatras-hat/response.rb', line 24 def redirect(*args) @request.redirect url_for(*args) end |
#render(action) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/sinatras-hat/response.rb', line 16 def render(action) begin @request.erb action.to_sym, :views_directory => views rescue Errno::ENOENT no_template! "Can't find #{File.expand_path(File.join(views, action.to_s))}.erb" end end |