Class: GLI::Commands::HelpModules::TTYOnlyWrapper
- Inherits:
-
Object
- Object
- GLI::Commands::HelpModules::TTYOnlyWrapper
- Defined in:
- lib/gli/commands/help_modules/tty_only_wrapper.rb
Overview
Formats text in one line, stripping newlines and NOT wrapping
Instance Method Summary collapse
-
#initialize(width, indent) ⇒ TTYOnlyWrapper
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) ⇒ TTYOnlyWrapper
Args are ignored entirely; this keeps it consistent with the TextWrapper interface
7 8 9 10 11 12 13 |
# File 'lib/gli/commands/help_modules/tty_only_wrapper.rb', line 7 def initialize(width,indent) @proxy = if STDOUT.tty? TextWrapper.new(width,indent) else OneLineWrapper.new(width,indent) end 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.
17 18 19 |
# File 'lib/gli/commands/help_modules/tty_only_wrapper.rb', line 17 def wrap(text) @proxy.wrap(text) end |