Class: HubLink::Batch
- Inherits:
-
Object
- Object
- HubLink::Batch
- Defined in:
- lib/hub_link/batch.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #fetch(resource) ⇒ Object
-
#initialize(options = {}) ⇒ Batch
constructor
A new instance of Batch.
- #issues ⇒ Object
- #pull_requests ⇒ Object
- #reviews ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Batch
Returns a new instance of Batch.
7 8 9 |
# File 'lib/hub_link/batch.rb', line 7 def initialize( = {}) @options = .compact end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/hub_link/batch.rb', line 5 def @options end |
Instance Method Details
#empty? ⇒ Boolean
11 12 13 |
# File 'lib/hub_link/batch.rb', line 11 def empty? results.empty? end |
#fetch(resource) ⇒ Object
15 16 17 |
# File 'lib/hub_link/batch.rb', line 15 def fetch(resource) public_send(resource) end |
#issues ⇒ Object
31 32 33 34 35 |
# File 'lib/hub_link/batch.rb', line 31 def issues log "Fetching issues" do (results - pull_request_results).map(&:to_h) end end |
#pull_requests ⇒ Object
19 20 21 22 23 |
# File 'lib/hub_link/batch.rb', line 19 def pull_requests log "Fetching pull requests" do pull_request_results.find_all(&:pull_request?).map(&:to_h) end end |
#reviews ⇒ Object
25 26 27 28 29 |
# File 'lib/hub_link/batch.rb', line 25 def reviews log "Fetching reviews" do pull_request_results.flat_map(&:reviews).map(&:to_h) end end |