Module: DiscreteMath

Includes:
Menu
Defined in:
lib/discrete_math.rb

Constant Summary

Constants included from Menu

Menu::EXIT_MAIN_MENU_OPTIONS

Class Method Summary collapse

Methods included from Menu

exit, request_input_for_menu, show_choices_main_menu, show_greeting, show_main_menu

Class Method Details

.run(arg) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/discrete_math.rb', line 6

def self.run(arg)
  ARGV << '--help' if ARGV.empty? and not arg

  aliases = {
    "d"  => "default"
  }

  command = ARGV.shift || arg
  command = aliases[command] || command
  case command
  # i.e. require 'discrete_math'; DiscreteMath.run(nil)
  when "--help"
    puts "Gem General User Usage: Try running within IRB: `require 'discrete_math'; DiscreteMath.run('default')`"
    puts "Gem Developer Contributor Usage: Try running 'rake discrete:run[d]' or 'ruby bin/discrete d'"
  # i.e. require 'discrete_math'; DiscreteMath.run("d")
  when "d", "default"
    Menu.show_choices_main_menu
  else
    Menu.show_choices_main_menu
  end
end