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

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, options = {})
  Alignment.align(text, width, direction, options)
end

.pad(text, padding, options = {}) ⇒ Object

Pad a text around with a given padding

See Also:



37
38
39
# File 'lib/verse.rb', line 37

def self.pad(text, padding, options = {})
  Padding.pad(text, padding, options)
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, options = {})
  Truncation.truncate(text, truncate_at, options)
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, options = {})
  Wrapping.wrap(text, wrap_at, options)
end