Class: WebCache::Response
- Inherits:
-
Object
- Object
- WebCache::Response
- Defined in:
- lib/webcache/response.rb
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
-
#content ⇒ Object
Returns the value of attribute content.
-
#error ⇒ Object
Returns the value of attribute error.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Response
constructor
A new instance of Response.
- #to_s ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/webcache/response.rb', line 5 def initialize(opts={}) if opts.respond_to?(:read) && opts.respond_to?(:base_uri) self.content = opts.read self.base_uri = opts.base_uri self.error = nil elsif opts.is_a? Hash self.error = opts[:error] if opts[:error] self.base_uri = opts[:base_uri] if opts[:base_uri] self.content = opts[:content] if opts[:content] end end |
Instance Attribute Details
#base_uri ⇒ Object
Returns the value of attribute base_uri.
3 4 5 |
# File 'lib/webcache/response.rb', line 3 def base_uri @base_uri end |
#content ⇒ Object
Returns the value of attribute content.
3 4 5 |
# File 'lib/webcache/response.rb', line 3 def content @content end |
#error ⇒ Object
Returns the value of attribute error.
3 4 5 |
# File 'lib/webcache/response.rb', line 3 def error @error end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/webcache/response.rb', line 17 def to_s content end |