Class: Eskimo::Components::Style

Inherits:
Eskimo::Component show all
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

Instance Method Summary collapse

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

#pastelObject (readonly)

Returns the value of attribute pastel



11
12
13
# File 'lib/eskimo/components/style.rb', line 11

def pastel
  @pastel
end

#styleObject (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

#renderObject



20
21
22
# File 'lib/eskimo/components/style.rb', line 20

def render(**)
  pastel.decorate(super, *style)
end