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



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

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

#build_stringObject



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

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



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

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

#insert_definition(mode, item_id, definition) ⇒ Object



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

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