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

Class Method Details

.align(*args, **kws) ⇒ Object

Align text within the width.

See Also:

  • Strings::Align#align


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.

See Also:

  • Strings::Align#align


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.

See Also:

  • Strings::Align#align_left


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.

See Also:

  • Strings::Align#align


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

Returns:

  • (Boolean)

See Also:

  • Strings::ANSI#ansi?


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

See Also:

  • Strings::Fold#fold


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

See Also:

  • Strings::Pad#pad


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

See Also:

  • Strings::ANSI#sanitize


88
89
90
# File 'lib/strings.rb', line 88

def sanitize(string)
  ANSI.sanitize(string)
end

.truncate(*args) ⇒ Object

Truncate a text at a given length

See Also:

  • Strings::Truncate#truncate


98
99
100
# File 'lib/strings.rb', line 98

def truncate(*args)
  Truncate.truncate(*args)
end

.wrap(*args) ⇒ Object

Wrap a text into lines at wrap length

See Also:

  • Strings::Wrap#wrap


108
109
110
# File 'lib/strings.rb', line 108

def wrap(*args)
  Wrap.wrap(*args)
end