Class: Prompts::Paragraph
- Inherits:
-
Object
- Object
- Prompts::Paragraph
- Includes:
- TextUtils
- Defined in:
- lib/prompts/paragraph.rb
Constant Summary collapse
- LINE_PADDING =
3
Constants included from TextUtils
Instance Method Summary collapse
-
#initialize(text, width: 60) ⇒ Paragraph
constructor
A new instance of Paragraph.
- #lines ⇒ Object
Methods included from TextUtils
#format_line, #strip_ansi, #wrap_text
Constructor Details
#initialize(text, width: 60) ⇒ Paragraph
Returns a new instance of Paragraph.
9 10 11 12 13 |
# File 'lib/prompts/paragraph.rb', line 9 def initialize(text, width: 60) @text = text @width = width - (LINE_PADDING + 1) @line_padding = SPACE * LINE_PADDING end |
Instance Method Details
#lines ⇒ Object
15 16 17 |
# File 'lib/prompts/paragraph.rb', line 15 def lines wrap_text(@text, width: @width, line_prefix: @line_padding, alignment: :none) end |