class Lsgh::Repository

Public Class Methods

new(repo, client) click to toggle source
# File lib/lsgh/repository.rb, line 3
def initialize(repo, client)
  @repo = repo
  @pull_requests = client.pull_requests.all(user: repo['owner']['login'], repo: repo['name'])
end

Public Instance Methods

to_paths() click to toggle source
# File lib/lsgh/repository.rb, line 8
def to_paths
  paths = [name]
  paths += pull_requests_paths.map do |path|
    "#{name}/#{path}"
  end

  paths
end
type() click to toggle source
# File lib/lsgh/repository.rb, line 17
def type
  if @repo['private']
    :private
  else
    :public
  end
end

Private Instance Methods

name() click to toggle source
# File lib/lsgh/repository.rb, line 39
def name
  @repo['name']
end
pull_requests_paths() click to toggle source
# File lib/lsgh/repository.rb, line 27
def pull_requests_paths
  paths = @pull_requests.group_by do |pull|
    pull['user']['login']
  end

  paths.map do |user, pr_group|
    pr_group.map do |pr|
      "#{user}/#{pr.title.tr('/', ' ')}"
    end
  end.inject(:+).to_a
end