Module: Kotoshu::Cli::Completions::ScriptBuilders
- Defined in:
- lib/kotoshu/cli/completions_command.rb
Overview
Pure template builders. Each takes the catalog and renders a shell-specific completion script. They have no IO dependencies and are unit-tested in isolation.
Defined Under Namespace
Class Method Summary collapse
-
.indent(text, n) ⇒ Object
Indent every line of
textbynspaces.
Class Method Details
.indent(text, n) ⇒ Object
Indent every line of text by n spaces. Used to align
interpolated blocks within their surrounding heredoc body.
41 42 43 44 |
# File 'lib/kotoshu/cli/completions_command.rb', line 41 def indent(text, n) pad = " " * n text.lines.map { |line| "#{pad}#{line}" }.join end |