Class: AboutDisplay

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

Instance Method Summary collapse

Constructor Details

#initialize(pastel, prompt, version) ⇒ AboutDisplay

Returns a new instance of AboutDisplay.



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

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

Instance Method Details

#displayObject



20
21
22
23
24
25
26
27
28
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
57
58
59
60
61
62
63
64
65
# File 'lib/tng/ui/about_display.rb', line 20

def display
  about_content = [
    "",
    @pastel.public_send(Tng::UI::Theme.color(:secondary),
                        "Tng is an LLM-powered test generation tool for Rails applications."),
    "",
    @pastel.public_send(Tng::UI::Theme.color(:accent), "Features:"),
    @pastel.public_send(Tng::UI::Theme.color(:muted),
                        "#{Tng::UI::Theme.icon(:bullet)} 20+ Rails file types supported"),
    @pastel.public_send(Tng::UI::Theme.color(:muted),
                        "#{Tng::UI::Theme.icon(:bullet)} Core: Controllers, Models, Services"),
    @pastel.public_send(Tng::UI::Theme.color(:muted),
                        "#{Tng::UI::Theme.icon(:bullet)} Extended: Jobs, Helpers, Lib, Policies, Presenters, Mailers, GraphQL + more"),
    @pastel.public_send(Tng::UI::Theme.color(:muted), "#{Tng::UI::Theme.icon(:bullet)} LLM-powered test suggestions"),
    @pastel.public_send(Tng::UI::Theme.color(:muted), "#{Tng::UI::Theme.icon(:bullet)} Test coverage analysis"),
    "",
    @pastel.public_send(Tng::UI::Theme.color(:accent), "Technology:"),
    @pastel.public_send(Tng::UI::Theme.color(:muted),
                        "#{Tng::UI::Theme.icon(:bullet)} Static code analysis with Prism"),
    @pastel.public_send(Tng::UI::Theme.color(:muted),
                        "#{Tng::UI::Theme.icon(:bullet)} Intelligent pattern recognition"),
    @pastel.public_send(Tng::UI::Theme.color(:muted), "#{Tng::UI::Theme.icon(:bullet)} Rails-specific optimizations"),
    "",
    @pastel.public_send(Tng::UI::Theme.color(:muted), "Version: #{@version}"),
    @pastel.public_send(Tng::UI::Theme.color(:muted),
                        "Built with #{Tng::UI::Theme.icon(:heart)} for Rails developers")
  ].join("\n")

  box_width = Tng::UI::Theme.calculate_box_width(@terminal_width)
  style = Tng::UI::Theme.box_style(:default)

  about_box = TTY::Box.frame(
    title: { top_left: " About Tng " },
    style: style[:style],
    padding: style[:padding],
    width: box_width
  ) do
    about_content
  end

  puts Tng::UI::Theme.center_box(about_box, box_width, @terminal_width)
  @prompt.keypress(Tng::UI::Theme.center_text(
                     @pastel.public_send(Tng::UI::Theme.color(:muted),
                                         "Press any key to continue..."), @terminal_width
                   ))
end