Class: DisplayBanner
- Inherits:
-
Object
- Object
- DisplayBanner
- Defined in:
- lib/tng/ui/display_banner.rb
Instance Attribute Summary collapse
-
#pastel ⇒ Object
readonly
Returns the value of attribute pastel.
-
#terminal_width ⇒ Object
readonly
Returns the value of attribute terminal_width.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(pastel, version) ⇒ DisplayBanner
constructor
A new instance of DisplayBanner.
- #render ⇒ Object
Constructor Details
#initialize(pastel, version) ⇒ DisplayBanner
9 10 11 12 13 14 15 16 17 |
# File 'lib/tng/ui/display_banner.rb', line 9 def initialize(pastel, version) @pastel = pastel @version = version @terminal_width = begin TTY::Screen.width rescue StandardError 80 end end |
Instance Attribute Details
#pastel ⇒ Object (readonly)
Returns the value of attribute pastel.
7 8 9 |
# File 'lib/tng/ui/display_banner.rb', line 7 def pastel @pastel end |
#terminal_width ⇒ Object (readonly)
Returns the value of attribute terminal_width.
7 8 9 |
# File 'lib/tng/ui/display_banner.rb', line 7 def terminal_width @terminal_width end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
7 8 9 |
# File 'lib/tng/ui/display_banner.rb', line 7 def version @version end |
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/tng/ui/display_banner.rb', line 19 def render = [ pastel.public_send(Tng::UI::Theme.color(:secondary)).bold("Tng - LLM-Powered Rails Test Generator"), pastel.public_send(Tng::UI::Theme.color(:muted), "Version: #{version}"), "", pastel.public_send(Tng::UI::Theme.color(:accent), "Generate comprehensive tests for your Rails application"), pastel.public_send(Tng::UI::Theme.color(:muted), "Powered by LLM and static analysis") ].join("\n") box_width = 64 box_width = terminal_width if box_width > terminal_width style = Tng::UI::Theme.box_style(:default) box = TTY::Box.frame( title: { top_left: " Tng ", bottom_right: " Ready " }, style: style[:style], padding: style[:padding], align: :center, width: box_width ) do end "#{Tng::UI::Theme.center_box(box, box_width, terminal_width)}\n" end |