Class: CircleCI::CLI::Printer::BuildPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/circleci/cli/printer/build_printer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builds, project_name, pretty: true) ⇒ BuildPrinter

Returns a new instance of BuildPrinter.



19
20
21
22
23
# File 'lib/circleci/cli/printer/build_printer.rb', line 19

def initialize(builds, project_name, pretty: true)
  @builds_to_show = builds
  @project_name = project_name
  @pretty = pretty
end

Class Method Details

.header_for(build, title) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/circleci/cli/printer/build_printer.rb', line 8

def header_for(build, title)
  texts = [
    ["Project:  #{build.project_name}"],
    ["Build:    #{build.build_number}"],
    ["Author:   #{build.author_name}"],
    ["Workflow: #{build.workflow_name}/#{build.workflow_job_name}"]
  ]
  Terminal::Table.new(title: title, rows: texts, style: { width: 120 }).to_s
end

Instance Method Details

#to_sObject



25
26
27
# File 'lib/circleci/cli/printer/build_printer.rb', line 25

def to_s
  @pretty ? print_pretty : print_compact
end