Class: Eskimo::Components::Style
- Inherits:
-
Eskimo::Component
- Object
- Eskimo::Component
- Eskimo::Components::Style
- Defined in:
- lib/eskimo/components/style.rb
Overview
Style text with colors and custom formatting.
See Pastel’s documentation for the accepted styles.
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
13 14 15 16 17 18 |
# File 'lib/eskimo/components/style.rb', line 13 def initialize(*style, &children) @style = style.flatten @pastel = Pastel.new super end |
Instance Attribute Details
#pastel ⇒ Object (readonly)
Returns the value of attribute pastel
11 12 13 |
# File 'lib/eskimo/components/style.rb', line 11 def pastel @pastel end |
#style ⇒ Object (readonly)
Returns the value of attribute style
11 12 13 |
# File 'lib/eskimo/components/style.rb', line 11 def style @style end |
Instance Method Details
#render ⇒ Object
20 21 22 |
# File 'lib/eskimo/components/style.rb', line 20 def render(**) pastel.decorate(super, *style) end |