Class: HammerCLI::Help::List

Inherits:
AbstractItem show all
Defined in:
lib/hammer_cli/help/definition/list.rb

Constant Summary collapse

LIST_INDENT =
20

Constants inherited from AbstractItem

AbstractItem::INDENT_STEP

Instance Attribute Summary

Attributes inherited from AbstractItem

#definition, #id, #richtext

Instance Method Summary collapse

Methods inherited from AbstractItem

indent

Constructor Details

#initialize(items, options = {}) ⇒ List

Returns a new instance of List.



6
7
8
9
10
# File 'lib/hammer_cli/help/definition/list.rb', line 6

def initialize(items, options = {})
  super(options)
  @indent_size = options[:indent_size] || indent_size(items)
  build_definition(items || [])
end

Instance Method Details

#build_stringObject



12
13
14
15
16
17
18
# File 'lib/hammer_cli/help/definition/list.rb', line 12

def build_string
  out = StringIO.new
  @definition.each do |item|
    out.puts item.build_string
  end
  out.string
end