Class: Vaulty::Output::Banner
- Inherits:
-
Object
- Object
- Vaulty::Output::Banner
- Defined in:
- lib/vaulty/output/banner.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(msg, color: :blue, prompt:) ⇒ Banner
constructor
A new instance of Banner.
- #render ⇒ Object
Constructor Details
#initialize(msg, color: :blue, prompt:) ⇒ Banner
Returns a new instance of Banner.
6 7 8 9 10 |
# File 'lib/vaulty/output/banner.rb', line 6 def initialize(msg, color: :blue, prompt:) @msg = msg @color = "on_#{color}".to_sym @prompt = prompt end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
4 5 6 |
# File 'lib/vaulty/output/banner.rb', line 4 def color @color end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
4 5 6 |
# File 'lib/vaulty/output/banner.rb', line 4 def msg @msg end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
4 5 6 |
# File 'lib/vaulty/output/banner.rb', line 4 def prompt @prompt end |
Class Method Details
.render(*args) ⇒ Object
19 20 21 |
# File 'lib/vaulty/output/banner.rb', line 19 def self.render(*args) new(*args).render end |
Instance Method Details
#render ⇒ Object
12 13 14 15 16 17 |
# File 'lib/vaulty/output/banner.rb', line 12 def render now = Time.new.strftime('%H:%M:%S') formatted = msg.ljust(72, ' ') prompt.say("[#{now}] #{formatted}", color: %I(bold white #{color})) puts end |