Module: EacCli::RunnerWith::Help::Layout::InstanceClassMethods

Included in:
EacCli::RunnerWith::Help::Layout
Defined in:
lib/eac_cli/runner_with/help/layout.rb

Constant Summary collapse

WORD_SEPARATOR =
' '
IDENTATION =
WORD_SEPARATOR * 2
OPTION_DESCRIPTION_SEPARATOR =
IDENTATION * 2
LINE_BREAK =
"\n"
SECTION_SEPARATOR =
LINE_BREAK * 2

Instance Method Summary collapse

Instance Method Details

#join_sections(*sections) ⇒ String

Parameters:

  • sections (Enumerable<String>)

Returns:

  • (String)


31
32
33
# File 'lib/eac_cli/runner_with/help/layout.rb', line 31

def join_sections(*sections)
  sections.map { |s| s.to_s.strip }.join(SECTION_SEPARATOR) + LINE_BREAK
end

#list_section(title, items) ⇒ String

Parameters:

  • title

    String

  • items (Enumerable<String>)

Returns:

  • (String)


24
25
26
27
# File 'lib/eac_cli/runner_with/help/layout.rb', line 24

def list_section(title, items)
  (["#{title}:"] + items.map { |line| "#{IDENTATION}#{line}" })
    .map { |line| "#{line}\n" }.join
end