Class: WebFetch::Result
- Inherits:
-
Object
- Object
- WebFetch::Result
- Defined in:
- lib/web_fetch/result.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#response_time ⇒ Object
readonly
Returns the value of attribute response_time.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
Instance Method Summary collapse
- #complete? ⇒ Boolean
-
#initialize(options = {}) ⇒ Result
constructor
A new instance of Result.
- #pending? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Result
Returns a new instance of Result.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/web_fetch/result.rb', line 7 def initialize( = {}) @pending = .fetch(:pending, false) return if pending? @body = .fetch(:body) @headers = .fetch(:headers) @status = .fetch(:status) @success = .fetch(:success) @error = .fetch(:error) @uid = .fetch(:uid) @response_time = .fetch(:response_time) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/web_fetch/result.rb', line 5 def body @body end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
5 6 7 |
# File 'lib/web_fetch/result.rb', line 5 def error @error end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
5 6 7 |
# File 'lib/web_fetch/result.rb', line 5 def headers @headers end |
#response_time ⇒ Object (readonly)
Returns the value of attribute response_time.
5 6 7 |
# File 'lib/web_fetch/result.rb', line 5 def response_time @response_time end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/web_fetch/result.rb', line 5 def status @status end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
5 6 7 |
# File 'lib/web_fetch/result.rb', line 5 def uid @uid end |
Instance Method Details
#complete? ⇒ Boolean
24 25 26 |
# File 'lib/web_fetch/result.rb', line 24 def complete? !pending? end |
#pending? ⇒ Boolean
20 21 22 |
# File 'lib/web_fetch/result.rb', line 20 def pending? @pending end |
#success? ⇒ Boolean
28 29 30 |
# File 'lib/web_fetch/result.rb', line 28 def success? @success end |