Module: Strings
- Defined in:
- lib/strings.rb,
lib/strings/pad.rb,
lib/strings/fold.rb,
lib/strings/wrap.rb,
lib/strings/align.rb,
lib/strings/padder.rb,
lib/strings/version.rb,
lib/strings/truncate.rb,
lib/strings/extensions.rb
Defined Under Namespace
Modules: Align, Extensions, Fold, Pad, Truncate, Wrap Classes: Padder
Constant Summary collapse
- VERSION =
"0.2.1"
Class Method Summary collapse
-
.align(*args, **kws) ⇒ Object
Align text within the width.
-
.align_center(*args) ⇒ Object
Align text with the width.
-
.align_left(*args) ⇒ Object
Align text left within the width.
-
.align_right(*args) ⇒ Object
Align text with the width.
-
.ansi?(string) ⇒ Boolean
Check if string contains ANSI codes.
-
.fold(*args) ⇒ Object
Remove any line break characters from the text.
-
.pad(*args) ⇒ Object
Apply padding to multiline text with ANSI codes.
-
.sanitize(string) ⇒ Object
Remove ANSI codes from the string.
-
.truncate(*args) ⇒ Object
Truncate a text at a given length.
-
.wrap(*args) ⇒ Object
Wrap a text into lines at wrap length.
Class Method Details
.align(*args, **kws) ⇒ Object
Align text within the width.
18 19 20 |
# File 'lib/strings.rb', line 18 def align(*args, **kws) Align.align(*args, **kws) end |
.align_center(*args) ⇒ Object
Align text with the width.
38 39 40 |
# File 'lib/strings.rb', line 38 def align_center(*args) Align.align_center(*args) end |
.align_left(*args) ⇒ Object
Align text left within the width.
28 29 30 |
# File 'lib/strings.rb', line 28 def align_left(*args) Align.align_left(*args) end |
.align_right(*args) ⇒ Object
Align text with the width.
48 49 50 |
# File 'lib/strings.rb', line 48 def align_right(*args) Align.align_right(*args) end |
.ansi?(string) ⇒ Boolean
Check if string contains ANSI codes
58 59 60 |
# File 'lib/strings.rb', line 58 def ansi?(string) ANSI.ansi?(string) end |
.fold(*args) ⇒ Object
Remove any line break characters from the text
68 69 70 |
# File 'lib/strings.rb', line 68 def fold(*args) Fold.fold(*args) end |
.pad(*args) ⇒ Object
Apply padding to multiline text with ANSI codes
78 79 80 |
# File 'lib/strings.rb', line 78 def pad(*args) Pad.pad(*args) end |
.sanitize(string) ⇒ Object
Remove ANSI codes from the string
88 89 90 |
# File 'lib/strings.rb', line 88 def sanitize(string) ANSI.sanitize(string) end |