Class: Eskimo::Components::Wrap
- Inherits:
-
Eskimo::Component
- Object
- Eskimo::Component
- Eskimo::Components::Wrap
- Defined in:
- lib/eskimo/components.rb
Overview
Wrap a block text with newlines at a certain threshold.
Instance Attribute Summary collapse
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(width: SCREEN_COLUMNS, &children) ⇒ Wrap
constructor
A new instance of Wrap.
- #render ⇒ Object
Constructor Details
#initialize(width: SCREEN_COLUMNS, &children) ⇒ Wrap
Returns a new instance of Wrap.
104 105 106 107 |
# File 'lib/eskimo/components.rb', line 104 def initialize(width: SCREEN_COLUMNS, &children) @width = width super(&children) end |
Instance Attribute Details
#width ⇒ Object (readonly)
Returns the value of attribute width.
102 103 104 |
# File 'lib/eskimo/components.rb', line 102 def width @width end |
Instance Method Details
#render ⇒ Object
109 110 111 |
# File 'lib/eskimo/components.rb', line 109 def render(**) Strings.wrap(super, width) end |