Class: Eskimo::Components::Style
- Inherits:
-
Eskimo::Component
- Object
- Eskimo::Component
- Eskimo::Components::Style
- Defined in:
- lib/eskimo/components.rb
Overview
Style text with colors and custom formatting.
See [Pastel’s documentation] for the accepted styles.
[pastel]: github.com/piotrmurach/pastel
Instance Attribute Summary collapse
-
#pastel ⇒ Object
readonly
Returns the value of attribute pastel.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Instance Method Summary collapse
-
#initialize(*style, &children) ⇒ Style
constructor
A new instance of Style.
- #render ⇒ Object
Constructor Details
#initialize(*style, &children) ⇒ Style
Returns a new instance of Style.
50 51 52 53 54 55 |
# File 'lib/eskimo/components.rb', line 50 def initialize(*style, &children) @style = style.flatten @pastel = Pastel.new super(&children) end |
Instance Attribute Details
#pastel ⇒ Object (readonly)
Returns the value of attribute pastel.
48 49 50 |
# File 'lib/eskimo/components.rb', line 48 def pastel @pastel end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
48 49 50 |
# File 'lib/eskimo/components.rb', line 48 def style @style end |
Instance Method Details
#render ⇒ Object
57 58 59 |
# File 'lib/eskimo/components.rb', line 57 def render(**) pastel.decorate(super, *style) end |