Method: BooticCli::Console#explain

Defined in:
lib/bootic_cli/console.rb

#explain(entity, include_links = true) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/bootic_cli/console.rb', line 13

def explain(entity, include_links = true)
  if entity.is_a?(String) || entity.is_a?(Integer)
    puts entity
    return
  end

  if entity.is_a?(Array)
    entity.each{|e| explain(e) }
    return
  end

  title 'PROPERTIES:'
  puts table(entity.properties)

  puts ''

  if include_links
    title 'LINKS (explain_link <ENTITY>, <LINK_NAME>):'
    puts links(entity.rels)

    puts ''
  end

  title 'ENTITIES (explain <SUBENTITY>):'
  puts entity.entities.keys.join("\r\n")

  puts '-' * SEPCOUNT
  puts ''
  nil
end