Class: TTY::Text
- Inherits:
-
Object
- Object
- TTY::Text
- Defined in:
- lib/tty/text.rb,
lib/tty/text/wrapping.rb,
lib/tty/text/truncation.rb
Overview
A class responsible for text manipulations
Defined Under Namespace
Classes: Truncation, Wrapping
Constant Summary collapse
- SPACE =
" ".freeze
- NEWLINE =
"\n".freeze
- DEFAULT_WIDTH =
80.freeze
Class Method Summary collapse
-
.truncate(text, *args) ⇒ Object
Truncate a text at a given length (defaults to 30).
-
.wrap(text, *args) ⇒ Object
Wrap a text into lines no longer than provided length.
Instance Method Summary collapse
-
#split_mode ⇒ Object
Specifies the split mode for words.
Class Method Details
.truncate(text, value) ⇒ Object .truncate(text, value, options) ⇒ Object
Truncate a text at a given length (defaults to 30)
80 81 82 |
# File 'lib/tty/text.rb', line 80 def self.truncate(text, *args) Truncation.new(text, *args).truncate end |
Instance Method Details
#split_mode ⇒ Object
Specifies the split mode for words
15 16 |
# File 'lib/tty/text.rb', line 15 def split_mode end |