Class: DocRepo::Response
- Inherits:
-
Object
- Object
- DocRepo::Response
- Defined in:
- lib/doc_repo/response.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #html {|params| ... } ⇒ Object
-
#initialize(type, params) ⇒ Response
constructor
A new instance of Response.
- #redirect {|params| ... } ⇒ Object
Constructor Details
#initialize(type, params) ⇒ Response
4 5 6 |
# File 'lib/doc_repo/response.rb', line 4 def initialize(type, params) @type = type ; @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/doc_repo/response.rb', line 3 def params @params end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/doc_repo/response.rb', line 3 def type @type end |
Class Method Details
.html(*params) ⇒ Object
8 9 10 |
# File 'lib/doc_repo/response.rb', line 8 def self.html(*params) self.new :html, params end |
.redirect(*params) ⇒ Object
12 13 14 |
# File 'lib/doc_repo/response.rb', line 12 def self.redirect(*params) self.new :redirect, params end |
Instance Method Details
#html {|params| ... } ⇒ Object
16 17 18 |
# File 'lib/doc_repo/response.rb', line 16 def html yield(*params) if type == :html end |
#redirect {|params| ... } ⇒ Object
20 21 22 |
# File 'lib/doc_repo/response.rb', line 20 def redirect yield(*params) if type == :redirect end |