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.
- #pull_requests ⇒ Object
- #review_requests ⇒ Object
- #reviews ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Batch
Returns a new instance of Batch.
8 9 10 |
# File 'lib/hub_link/batch.rb', line 8 def initialize( = {}) = .compact end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/hub_link/batch.rb', line 6 def end |
Instance Method Details
#empty? ⇒ Boolean
12 13 14 |
# File 'lib/hub_link/batch.rb', line 12 def empty? results.empty? end |
#fetch(resource) ⇒ Object
16 17 18 |
# File 'lib/hub_link/batch.rb', line 16 def fetch(resource) public_send(resource) end |
#pull_requests ⇒ Object
20 21 22 23 24 |
# File 'lib/hub_link/batch.rb', line 20 def pull_requests log "Fetching pull requests" do results.map(&:to_h) end end |
#review_requests ⇒ Object
32 33 34 35 36 |
# File 'lib/hub_link/batch.rb', line 32 def review_requests log "Fetching review requests" do results.flat_map(&:review_requests).map(&:to_h) end end |
#reviews ⇒ Object
26 27 28 29 30 |
# File 'lib/hub_link/batch.rb', line 26 def reviews log "Fetching reviews" do results.flat_map(&:reviews).map(&:to_h) end end |