Class: Bcome::RenderIrb
Instance Method Summary collapse
- #construct_menu_item_string(item, index, colour) ⇒ Object
- #list_items(parent_collection, items) ⇒ Object
- #menu(menu_items, stack_level_instance) ⇒ Object
- #tab ⇒ Object
Instance Method Details
#construct_menu_item_string(item, index, colour) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/render_irb.rb', line 38 def (item, index, colour) command = item[:command] description = item[:description] usage = item[:usage] = "#{tab}#{index+1}. #{description}".send(colour) + "\n" += "#{tab}" + "Command: ". + "#{command}\n". += "#{tab}" + "Usage: ". + "#{usage}\n". if usage += "\n" return end |
#list_items(parent_collection, items) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/render_irb.rb', line 3 def list_items(parent_collection, items) if !items || !items.any? print "\n\sNo resources collections found. Maybe you forgot to add any?".headsup else print "\n\s" puts "#{parent_collection.to_s.}\n". items.each do |item| puts "\t*/added".danger + "\n" if item.highlight? print item.do_describe end print "\n\s\sUse cd [node identifier], e.g. cd :#{items.first.identifier} OR cd \"#{items.first.identifier}\" to work on a given node.\n\n" end end |
#menu(menu_items, stack_level_instance) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/render_irb.rb', line 17 def (, stack_level_instance) = "\n\s#{"Basic Commands".}\n\n" .each_with_index do |item, index| += (item, index, :menu_item_green) end = ::Bcome::Orchestrator::Recipe.(stack_level_instance) if .any? += "\n\s#{"Orchestration Menu".}\n\n" .each_with_index do |item, index| += (item, index, :menu_item_orange) end end += stack_level_instance.context_commands if stack_level_instance.context_commands += "\n\n" print return end |
#tab ⇒ Object
49 50 51 |
# File 'lib/render_irb.rb', line 49 def tab "\s\s\s" end |