Module: Verse
- Defined in:
- lib/verse.rb,
lib/verse/padder.rb,
lib/verse/padding.rb,
lib/verse/version.rb,
lib/verse/wrapping.rb,
lib/verse/alignment.rb,
lib/verse/sanitizer.rb,
lib/verse/truncation.rb
Defined Under Namespace
Modules: Sanitizer Classes: Alignment, Padder, Padding, Truncation, Wrapping
Constant Summary collapse
- SPACE =
' '.freeze
- NEWLINE =
"\n".freeze
- RESET =
"\e[0m".freeze
- ANSI =
"\033".freeze
- SPACE_RE =
%r{\s+}mo.freeze
- NEWLINE_RE =
%r{\n}o.freeze
- ParseError =
Class.new(ArgumentError)
- VERSION =
'0.5.0'
Class Method Summary collapse
-
.align(text, width, direction, options = {}) ⇒ Object
Align a text to a given direction with the width.
-
.pad(text, padding, options = {}) ⇒ Object
Pad a text around with a given padding.
-
.truncate(text, truncate_at, options = {}) ⇒ Object
Truncate a text at a given length.
-
.wrap(text, wrap_at, options = {}) ⇒ Object
Wrap a text into lines at wrap length.
Class Method Details
.align(text, width, direction, options = {}) ⇒ Object
Align a text to a given direction with the width
28 29 30 |
# File 'lib/verse.rb', line 28 def self.align(text, width, direction, = {}) Alignment.align(text, width, direction, ) end |
.pad(text, padding, options = {}) ⇒ Object
Pad a text around with a given padding
37 38 39 |
# File 'lib/verse.rb', line 37 def self.pad(text, padding, = {}) Padding.pad(text, padding, ) end |
.truncate(text, truncate_at, options = {}) ⇒ Object
Truncate a text at a given length
46 47 48 |
# File 'lib/verse.rb', line 46 def self.truncate(text, truncate_at, = {}) Truncation.truncate(text, truncate_at, ) end |
.wrap(text, wrap_at, options = {}) ⇒ Object
Wrap a text into lines at wrap length
55 56 57 |
# File 'lib/verse.rb', line 55 def self.wrap(text, wrap_at, = {}) Wrapping.wrap(text, wrap_at, ) end |