Class: HammerCLI::Help::Definition

Inherits:
Array
  • Object
show all
Defined in:
lib/hammer_cli/help/definition.rb

Instance Method Summary collapse

Instance Method Details

#at(path) ⇒ Object



24
25
26
27
28
# File 'lib/hammer_cli/help/definition.rb', line 24

def at(path)
  return super(path) if path.is_a? Integer
  return self if path.empty?
  expand_path(path)
end

#build_stringObject



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

def build_string
  @out = StringIO.new
  each do |item|
    next unless item.is_a? AbstractItem
    @out.puts unless first_print?
    @out.puts item.build_string
  end
  @out.string
end

#find_item(item_id) ⇒ Object



20
21
22
# File 'lib/hammer_cli/help/definition.rb', line 20

def find_item(item_id)
  self[item_index(item_id)]
end

#insert_definition(mode, item_id, definition) ⇒ Object



30
31
32
# File 'lib/hammer_cli/help/definition.rb', line 30

def insert_definition(mode, item_id, definition)
  HammerCLI.insert_relative(self, mode, item_index(item_id), *definition)
end