class Michael::Models::Repository

Attributes

org_name[R]
prs[R]

Public Class Methods

new(org_name, prs: nil) click to toggle source
# File lib/michael/models/repository.rb, line 10
def initialize(org_name, prs: nil)
  @org_name = org_name
  @prs = prs
end

Public Instance Methods

==(other) click to toggle source
# File lib/michael/models/repository.rb, line 23
def ==(other)
  org_name == other.org_name &&
    prs == other.prs
end
broken?() click to toggle source
# File lib/michael/models/repository.rb, line 15
def broken?
  prs.nil?
end
has_prs?() click to toggle source
# File lib/michael/models/repository.rb, line 19
def has_prs?
  !broken? && prs.any?
end
pretty_print() click to toggle source
# File lib/michael/models/repository.rb, line 28
def pretty_print
  return pastel.black.on_red(org_name) if broken?
  return org_name if prs.none?

  [
    pastel.bold(org_name + ':'),
    prs.map(&:pretty_print).join("\n")
  ].join("\n")
end

Private Instance Methods

pastel() click to toggle source
# File lib/michael/models/repository.rb, line 40
def pastel
  @pastel ||= Pastel.new
end