class HammerCLI::Help::Section

Attributes

label[R]

Public Class Methods

new(label, definition = nil, options = {}) click to toggle source
Calls superclass method HammerCLI::Help::AbstractItem::new
# 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

Public Instance Methods

build_string() click to toggle source
# 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

Protected Instance Methods

build_definition(content) click to toggle source
# File lib/hammer_cli/help/definition/section.rb, line 22
def build_definition(content)
  @definition = content || Definition.new
end

Private Instance Methods

heading() click to toggle source
# File lib/hammer_cli/help/definition/section.rb, line 28
def heading
  label = "#{@label}:"
  label = HighLine.color(label, :bold) if @richtext
  label
end