module Taxplorer::Command
Public Instance Methods
child_nodes_prompt(nodes)
click to toggle source
# File lib/taxplorer/command.rb, line 41 def child_nodes_prompt(nodes) choose do |menu| menu.prompt = "Select node" nodes.each do |s| menu.choice(s[:label]) { |s| node_commands(s)} end end end
clear()
click to toggle source
# File lib/taxplorer/command.rb, line 76 def clear system "clear" or system "cls" end
load_shell()
click to toggle source
# File lib/taxplorer/command.rb, line 4 def load_shell loop do welcome_prompt break if @run == false end puts "bye bye" end
node_commands(node)
click to toggle source
# File lib/taxplorer/command.rb, line 50 def node_commands(node) puts "Viewing #{node}" cmd = ask("Enter command: ", %w{info children parent menu tree quit}) {|q| q.readline = true} case cmd when "info" get_info(node) when "children" get_children(node) when "parent" get_parent(node) when "menu" menu_prompt when "tree" clear puts tree_view(node) puts "\n\n" node_commands(node) when "quit" quit end end
quit()
click to toggle source
# File lib/taxplorer/command.rb, line 72 def quit @run = false end
section_prompt(section_name)
click to toggle source
# File lib/taxplorer/command.rb, line 31 def section_prompt(section_name) clear choose do |menu| menu.prompt = "Choose Heading" get_section(section_name).each do |s| menu.choice(s[:label]) { |s| node_commands(s)} end end end
welcome_prompt()
click to toggle source
# File lib/taxplorer/command.rb, line 12 def welcome_prompt choose do |menu| menu.prompt = "Choose preferred taxonomy" ["UK GAAP", "UK IFRS"].each do |t| menu.choice(t) { |c| say("have a glass of whiskey while we load up #{c} for you"); load_taxonomy } end end end