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.
- checksums.yaml +4 -4
- data/bin/discrete +2 -0
- data/lib/discrete_math.rb +49 -31
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7c4500baf779fd4b59b9cae70b544625df9dcd5
|
4
|
+
data.tar.gz: '01083f8592ec77b3cdfd40affa4c060b82fa2b6e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac076337e221f6207f8ae5fe1c751eb8fb07e5802eaebae5a0d00f75ad0979cc21bc9bdc8ae7b0f90f2fd4aa2afff327fff0e6367ed2d4fe3a720ece33fef899
|
7
|
+
data.tar.gz: 55ad5b517256dfdf37712f17c8d42cae2b23848a1f3bdbf621271f35b0833219654f63ba3454066ae43fbc320d7b8f084ce46b46551378b13d4aed5a95aabf9e
|
data/bin/discrete
CHANGED
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
|
-
|
15
|
+
module Menu
|
16
|
+
include DiscreteMathTopics::PreliminaryMath::AbsoluteValuesDemo::LocationConfig # @@location_coordinates
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
USER_OPTIONS = {
|
19
|
+
"1": :demo_power_of
|
20
|
+
}
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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.
|
49
|
-
|
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.
|
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-
|
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
|