class Startling::Work

Attributes

branch[R]
pull_requests[R]

Public Class Methods

all() click to toggle source
# File lib/startling/work.rb, line 32
def self.all
  repos = Startling.repos.map { |name| Github.repo(name) }
  pull_requests = Parallel.map(repos, in_threads: repos.count, &:pull_requests).flatten
  from_pull_requests(pull_requests)
end
from_pull_requests(pull_requests) click to toggle source
# File lib/startling/work.rb, line 38
def self.from_pull_requests(pull_requests)
  work = pull_requests.group_by(&:branch)
  work.map { |branch, pulls| new(branch, pulls) }
end
in_progress() click to toggle source
# File lib/startling/work.rb, line 43
def self.in_progress
  all.select(&:in_progress?)
end
new(branch, pull_requests) click to toggle source
# File lib/startling/work.rb, line 10
def initialize(branch, pull_requests)
  @branch = branch
  @pull_requests = pull_requests
end

Public Instance Methods

authors() click to toggle source
# File lib/startling/work.rb, line 24
def authors
  pull_requests.map(&:author).uniq.sort
end
in_progress?() click to toggle source
# File lib/startling/work.rb, line 15
def in_progress?
  pull_requests.any?(&:in_progress?)
end
started_at() click to toggle source
# File lib/startling/work.rb, line 28
def started_at
  pull_requests.map(&:created_at).min
end
to_s() click to toggle source
# File lib/startling/work.rb, line 19
def to_s
  "#{authors.join(", ").blue} - #{branch.to_s.yellow}\n" +
    pull_requests.map { |p| "    #{p}"}.join("\n")
end