Class: HammerCLI::Help::Section

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

Constant Summary

Constants inherited from AbstractItem

AbstractItem::INDENT_STEP

Instance Attribute Summary collapse

Attributes inherited from AbstractItem

#definition, #id, #richtext

Instance Method Summary collapse

Methods inherited from AbstractItem

indent

Constructor Details

#initialize(label, definition = nil, options = {}) ⇒ Section

Returns a new instance of Section.



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

def initialize(label, definition = nil, options = {})
  super(options)
  @label = label
  @id ||= label
  build_definition(definition)
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



4
5
6
# File 'lib/hammer_cli/help/definition/section.rb', line 4

def label
  @label
end

Instance Method Details

#build_stringObject



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

def build_string
  out = StringIO.new
  out.puts heading
  out.puts indent(@definition.build_string)
  out.string
end