Method: Tools::Disclaimer#show

Defined in:
lib/tools/disclaimer.rb

#show(title: nil, texts: []) ⇒ Object

Prints a box containing a title and an explanation of the action that will be performed.

Example:

| | | POSTGRESQL BACKUP GEM | | |

| | | Dolore ipsum sunt amet laborum | | voluptate elit tempor minim | | officia ex amet incididunt. | | |



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/tools/disclaimer.rb', line 29

def show(title: nil, texts: [])
  output = ['']

  if title
    output << horizontal_character * columns
    output << empty_line
    output << centralized_text(title)
    output << empty_line
  end

  output << horizontal_character * columns
  output << empty_line

  Array(texts).each do |text|
    paragraphs = break_text_into_paragraphs(text)
    paragraphs.each do |text|
      output << left_aligned_text(text)
    end
  end
  output << empty_line

  output << horizontal_character * columns
  output << ''

  output.each { |line| puts line } if print_output

  output
end