Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/core_ext/string/wrap.rb,
lib/core_ext/string/deansi.rb,
lib/core_ext/string/demodulize.rb
Instance Method Summary collapse
Instance Method Details
#deansi ⇒ Object
4 5 6 |
# File 'lib/core_ext/string/deansi.rb', line 4 def deansi gsub(ANSI::Code::PATTERN, '') end |
#demodulize ⇒ Object
2 3 4 |
# File 'lib/core_ext/string/demodulize.rb', line 2 def demodulize split('::').last end |
#wrap(width) ⇒ Object
2 3 4 |
# File 'lib/core_ext/string/wrap.rb', line 2 def wrap(width) gsub(/(.{1,#{width}})( +|$\n?)|(.{1,#{width}})/, "\\1\\3\n") end |