bored-wikipedia-explorer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/command_line_interface.rb +10 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8abae75c9b526cc285211951c1c71b83d919866ef61fecdd986ece5a55ac3dce
|
4
|
+
data.tar.gz: 87d80cdee14d85ffc0bb9adceca1e8637add4e0cef8f52d6bda420c025fb010c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fbdacb4ad72dc60c3b20535e04df1e4d168eba373847bee7c7c62cccfbf1ac074228fb0321518d934661bd829780c0832aeccee905f429e85fa1edb2fb30fb8
|
7
|
+
data.tar.gz: 9de8ca8c93f90cdfff76c0fc2161aaa03c0cea801a76616db8c65eecb8cf7365c14fbe1befdf02a45661fd230347c5fd242e9e5f2620d1167b02b8684b227a3b
|
@@ -6,11 +6,13 @@ class CommandLineInterface
|
|
6
6
|
def self.run
|
7
7
|
puts "Welcome to Did-You-Know Wikipedia Edition!"
|
8
8
|
puts "Please select a topic to be given a random Wikipedia Portal to read:"
|
9
|
+
generate_topic_list
|
10
|
+
display_all_topics #Displays all available main topics
|
9
11
|
get_inputs #starts cli flow
|
10
12
|
end
|
11
13
|
|
12
14
|
def self.get_inputs
|
13
|
-
display_all_topics
|
15
|
+
display_all_topics
|
14
16
|
puts "Select a number to explore that topic"
|
15
17
|
get_choice #gets users main topic choice
|
16
18
|
get_rand_url #gets random sub-topic and creates Portal objects
|
@@ -20,10 +22,15 @@ class CommandLineInterface
|
|
20
22
|
#beautifies and lists the command line options
|
21
23
|
def self.display_all_topics
|
22
24
|
colors = [:red, :green, :yellow, :blue, :magenta, :cyan, :red, :green, :yellow, :blue, :magenta]
|
25
|
+
@list.each_with_index{|item,indx|
|
26
|
+
puts "#{indx + 1}. #{item}".colorize(colors[indx])
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.generate_topic_list
|
23
31
|
@list = []
|
24
|
-
Topic.all_topics_list.
|
32
|
+
Topic.all_topics_list.each{|item|
|
25
33
|
@list << item
|
26
|
-
puts "#{indx + 1}. #{item}".colorize(colors[indx])
|
27
34
|
}
|
28
35
|
end
|
29
36
|
|