Class: GoodbyeDisplay

Inherits:
Object
  • Object
show all
Defined in:
lib/tng/ui/goodbye_display.rb

Instance Method Summary collapse

Constructor Details

#initialize(pastel) ⇒ GoodbyeDisplay



9
10
11
12
13
14
15
16
# File 'lib/tng/ui/goodbye_display.rb', line 9

def initialize(pastel)
  @pastel = pastel
  @terminal_width = begin
    TTY::Screen.width
  rescue StandardError
    80
  end
end

Instance Method Details

#displayObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/tng/ui/goodbye_display.rb', line 18

def display
  box_width = Tng::UI::Theme.calculate_box_width(@terminal_width)
  style = Tng::UI::Theme.box_style(:success)

  goodbye_box = TTY::Box.frame(
    title: { top_left: " Thank You " },
    style: style[:style],
    padding: style[:padding],
    align: :center,
    width: box_width
  ) do
    [
      @pastel.public_send(Tng::UI::Theme.color(:success)).bold("Thanks for using Tng!"),
      "",
      @pastel.public_send(Tng::UI::Theme.color(:secondary), "Happy testing!"),
      "",
      @pastel.public_send(Tng::UI::Theme.color(:muted), "Your Rails tests are now supercharged with LLM")
    ].join("\n")
  end

  puts Tng::UI::Theme.center_box(goodbye_box, box_width, @terminal_width)
  puts
end