Class: Tsumamigui::Request
- Inherits:
-
Object
- Object
- Tsumamigui::Request
- Defined in:
- lib/tsumamigui/request.rb
Constant Summary collapse
- INTERVAL =
sec
1.0..3.0
Instance Attribute Summary collapse
-
#urls ⇒ Object
readonly
Returns the value of attribute urls.
Class Method Summary collapse
-
.run(*urls) ⇒ Array<Tsumamigui::Response>
Response instances.
Instance Method Summary collapse
-
#exec_request ⇒ Array<Tsumamigui::Response>
Execute request and return responses.
-
#initialize(*urls) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(*urls) ⇒ Request
Returns a new instance of Request.
22 23 24 25 |
# File 'lib/tsumamigui/request.rb', line 22 def initialize(*urls) @urls = urls.flatten raise ArgumentError, 'No argument is specified' if @urls.empty? end |
Instance Attribute Details
#urls ⇒ Object (readonly)
Returns the value of attribute urls.
18 19 20 |
# File 'lib/tsumamigui/request.rb', line 18 def urls @urls end |
Class Method Details
.run(*urls) ⇒ Array<Tsumamigui::Response>
Returns response instances.
11 12 13 |
# File 'lib/tsumamigui/request.rb', line 11 def run(*urls) new(urls).exec_request end |
Instance Method Details
#exec_request ⇒ Array<Tsumamigui::Response>
Execute request and return responses
29 30 31 |
# File 'lib/tsumamigui/request.rb', line 29 def exec_request @urls.map { |url| fetch(url) } end |