Class: GLI::Commands::HelpModules::OneLineWrapper
- Inherits:
-
Object
- Object
- GLI::Commands::HelpModules::OneLineWrapper
- Defined in:
- lib/gli/commands/help_modules/one_line_wrapper.rb
Overview
Formats text in one line, stripping newlines and NOT wrapping
Instance Method Summary collapse
-
#initialize(width, indent) ⇒ OneLineWrapper
constructor
Args are ignored entirely; this keeps it consistent with the TextWrapper interface.
-
#wrap(text) ⇒ Object
Return a wrapped version of text, assuming that the first line has already been indented by @indent characters.
Constructor Details
#initialize(width, indent) ⇒ OneLineWrapper
Args are ignored entirely; this keeps it consistent with the TextWrapper interface
7 8 |
# File 'lib/gli/commands/help_modules/one_line_wrapper.rb', line 7 def initialize(width,indent) end |
Instance Method Details
#wrap(text) ⇒ Object
Return a wrapped version of text, assuming that the first line has already been indented by @indent characters. Resulting text does NOT have a newline in it.
12 13 14 |
# File 'lib/gli/commands/help_modules/one_line_wrapper.rb', line 12 def wrap(text) return String(text).gsub(/\n+/,' ').strip end |