class HammerCLI::Help::AbstractItem

Constants

INDENT_STEP

Attributes

definition[RW]
id[R]

Public Class Methods

indent(content, indentation = nil) click to toggle source
# File lib/hammer_cli/help/definition/abstract_item.rb, line 18
def self.indent(content, indentation = nil)
  indentation ||= ' ' * INDENT_STEP
  content = content.split("\n") unless content.is_a? Array
  content.map do |line|
    (indentation + line).rstrip
  end.join("\n")
end
new(options = {}) click to toggle source
# File lib/hammer_cli/help/definition/abstract_item.rb, line 9
def initialize(options = {})
  @id = options[:id]
  @indentation = options[:indentation]
end

Public Instance Methods

build_string() click to toggle source
# File lib/hammer_cli/help/definition/abstract_item.rb, line 14
def build_string
  raise NotImplementedError
end

Protected Instance Methods

build_definition(content) click to toggle source
# File lib/hammer_cli/help/definition/abstract_item.rb, line 28
def build_definition(content)
  raise NotImplementedError
end
indent(content, indentation = nil) click to toggle source
# File lib/hammer_cli/help/definition/abstract_item.rb, line 32
def indent(content, indentation = nil)
  indentation ||= @indentation
  self.class.indent(content, indentation)
end