discrete_math 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/discrete +2 -0
  3. data/lib/discrete_math.rb +49 -31
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10c604482ca133fd2b8f1b56a7caea98c42d9b0f
4
- data.tar.gz: 83bcd179028a682ee1c77b34c0cc198ded2486cc
3
+ metadata.gz: d7c4500baf779fd4b59b9cae70b544625df9dcd5
4
+ data.tar.gz: '01083f8592ec77b3cdfd40affa4c060b82fa2b6e'
5
5
  SHA512:
6
- metadata.gz: 79d1ca0227fd2584bba55853cb6cda3f05e80cf26a154a1eafaa62c923cb878896f4352c066cd11bb3069e99b2a2ffa168e6463b5e41584aaa1fcbf16a9002f8
7
- data.tar.gz: a36af9bce8a455ed7a7f53d8c6642d8b5a3f0dd26531ba6e41a90d62c7e88667fd348a225ffd22346353008d2a3f2f175a95aba545299d2e955a025d3aa72bb4
6
+ metadata.gz: ac076337e221f6207f8ae5fe1c751eb8fb07e5802eaebae5a0d00f75ad0979cc21bc9bdc8ae7b0f90f2fd4aa2afff327fff0e6367ed2d4fe3a720ece33fef899
7
+ data.tar.gz: 55ad5b517256dfdf37712f17c8d42cae2b23848a1f3bdbf621271f35b0833219654f63ba3454066ae43fbc320d7b8f084ce46b46551378b13d4aed5a95aabf9e
data/bin/discrete CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require_relative '../lib/discrete_math.rb'
4
+ arg = ARGV[0]
5
+ DiscreteMath.run(arg)
data/lib/discrete_math.rb CHANGED
@@ -11,43 +11,61 @@ module DiscreteMath
11
11
  route_first = AbsoluteValuesDemo::Route.new(location_first, location_second)
12
12
  end
13
13
  end
14
- end
15
14
 
16
- module Menu
17
- include DiscreteMathTopics::PreliminaryMath::AbsoluteValuesDemo::LocationConfig # @@location_coordinates
15
+ module Menu
16
+ include DiscreteMathTopics::PreliminaryMath::AbsoluteValuesDemo::LocationConfig # @@location_coordinates
18
17
 
19
- USER_OPTIONS = {
20
- "1": :demo_power_of
21
- }
18
+ USER_OPTIONS = {
19
+ "1": :demo_power_of
20
+ }
22
21
 
23
- def self.request_user_choice_demo
24
- user_choice = ""
25
- while not USER_OPTIONS.keys.include? user_choice.to_i
26
- system('clear')
27
- if user_choice == "invalid"
28
- puts "== Invalid option chosen. Try again ==\n"
29
- end
30
- puts """
31
- Select demo number to run or 'q' to quit:\n
32
- 1) Demo power of
33
- """
34
- user_choice = gets.chomp
35
- if user_choice == "1"
36
- puts "Calculating distance from Sydney to Melbourne..."
37
- route_first = DiscreteMath::Power.get_distance
38
- Menu.show_result(route_first.distance)
39
- break
40
- elsif user_choice == "q"
41
- break
42
- else
43
- user_choice = "invalid"
22
+ def self.request_user_choice_demo
23
+ user_choice = ""
24
+ while not USER_OPTIONS.keys.include? user_choice.to_i
25
+ # system('clear')
26
+ if user_choice == "invalid"
27
+ puts "== Invalid option chosen. Try again ==\n"
28
+ end
29
+ puts """
30
+ Select demo number to run or 'q' to quit:\n
31
+ 1) Demo power of
32
+ """
33
+ user_choice = gets.chomp
34
+ if user_choice == "1"
35
+ puts "Calculating distance from Sydney to Melbourne..."
36
+ route_first = DiscreteMath::Power.get_distance
37
+ Menu.show_result(route_first.distance)
38
+ break
39
+ elsif user_choice == "q"
40
+ break
41
+ else
42
+ user_choice = "invalid"
43
+ end
44
44
  end
45
45
  end
46
+
47
+ def self.show_result(result)
48
+ puts "=====> Demo Power Of result is: #{result}"
49
+ end
46
50
  end
47
51
 
48
- def self.show_result(result)
49
- puts "=====> Demo Power Of result is: #{result}"
52
+ def self.run(arg)
53
+ ARGV << '--help' if ARGV.empty? and not arg
54
+
55
+ aliases = {
56
+ "d" => "default"
57
+ }
58
+
59
+ command = ARGV.shift || arg
60
+ command = aliases[command] || command
61
+ case command
62
+ when "--help"
63
+ puts "Gem General User Usage: Try running within IRB: `require 'discrete_math'; DiscreteMath.run('default')`"
64
+ puts "Gem Developer Contributor Usage: Try running 'rake discrete:run[d]' or 'ruby bin/discrete d'"
65
+ when "d", "default"
66
+ DiscreteMath::Menu.request_user_choice_demo
67
+ else
68
+ DiscreteMath::Menu.request_user_choice_demo
69
+ end
50
70
  end
51
71
  end
52
-
53
- Menu.request_user_choice_demo
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discrete_math
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Schoen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-30 00:00:00.000000000 Z
12
+ date: 2017-10-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A discrete math gem
15
15
  email: ltfschoen@gmail.com