Class: Michael::Models::Repository
- Inherits:
-
Object
- Object
- Michael::Models::Repository
- Defined in:
- lib/michael/models/repository.rb
Instance Attribute Summary collapse
-
#org_name ⇒ Object
readonly
Returns the value of attribute org_name.
-
#prs ⇒ Object
readonly
Returns the value of attribute prs.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #broken? ⇒ Boolean
- #has_prs? ⇒ Boolean
-
#initialize(org_name, prs: nil) ⇒ Repository
constructor
A new instance of Repository.
- #pretty_print ⇒ Object
Constructor Details
#initialize(org_name, prs: nil) ⇒ Repository
Returns a new instance of Repository.
10 11 12 13 |
# File 'lib/michael/models/repository.rb', line 10 def initialize(org_name, prs: nil) @org_name = org_name @prs = prs end |
Instance Attribute Details
#org_name ⇒ Object (readonly)
Returns the value of attribute org_name.
8 9 10 |
# File 'lib/michael/models/repository.rb', line 8 def org_name @org_name end |
#prs ⇒ Object (readonly)
Returns the value of attribute prs.
8 9 10 |
# File 'lib/michael/models/repository.rb', line 8 def prs @prs end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 |
# File 'lib/michael/models/repository.rb', line 23 def ==(other) org_name == other.org_name && prs == other.prs end |
#broken? ⇒ Boolean
15 16 17 |
# File 'lib/michael/models/repository.rb', line 15 def broken? prs.nil? end |
#has_prs? ⇒ Boolean
19 20 21 |
# File 'lib/michael/models/repository.rb', line 19 def has_prs? !broken? && prs.any? end |
#pretty_print ⇒ Object
28 29 30 31 32 33 34 35 36 |
# 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 |