class Circler::ProjectPrinter
Attributes
compact[RW]
Public Class Methods
new(projects, pretty: true)
click to toggle source
# File lib/circler/printer/project_printer.rb, line 6 def initialize(projects, pretty: true) @projects = projects @pretty = pretty end
Public Instance Methods
to_s()
click to toggle source
# File lib/circler/printer/project_printer.rb, line 11 def to_s @pretty ? print_pretty : print_compact end
Private Instance Methods
print_compact()
click to toggle source
# File lib/circler/printer/project_printer.rb, line 17 def print_compact @projects .map(&:information) .map { |array| array.join('/').to_s } .sort .join("\n") end
print_pretty()
click to toggle source
# File lib/circler/printer/project_printer.rb, line 25 def print_pretty Terminal::Table.new( title: 'Projects'.green, headings: ['User name', 'Repository name'], rows: @projects.map(&:information) ).to_s end