Class: Kafo::HelpBuilders::Base

Inherits:
Clamp::Help::Builder
  • Object
show all
Includes:
StringHelper
Defined in:
lib/kafo/help_builders/base.rb

Direct Known Subclasses

Advanced, Basic

Instance Method Summary collapse

Methods included from StringHelper

#dashize, #parametrize, #underscore, #with_prefix

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



12
13
14
15
# File 'lib/kafo/help_builders/base.rb', line 12

def initialize(params)
  super()
  @params = params
end

Instance Method Details

#add_list(heading, items) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/kafo/help_builders/base.rb', line 17

def add_list(heading, items)
  return if items.empty?
  if heading == 'Options'
    line "\n#{heading}:"

    data = by_module(items)

    sorted_keys(data).each do |section|
      if section == DEFAULT_MODULE_NAME
        add_list(header(1, section), data[section])
      else
        add_module(section, data[section])
      end
    end
  else
    super
  end
end