ruby_terminal_games 0.1.0 → 0.1.1
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/lib/ruby_terminal_games/hangman/word.rb +5 -2
- data/lib/ruby_terminal_games/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33a5a845ad2fa70bcfb583e07de91e99365c6166
|
4
|
+
data.tar.gz: 71a0188aca20407a84d330fcc146eee7e0fd1c2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8290f1216a58bd49934b890c0583797ea65e370502a4d1b784902d6f4f6ede849cf09fa9d19eb92c0af40c0aade950afe2379b3cd3ee01039c39994a069ca11
|
7
|
+
data.tar.gz: f74ba59d7a52048571bbfb7951efea69b81389c1d99aad6451bc47b4b8e87bba537730504416523d19b21ded48822e33ca8a6af4be55a594072770cdfc023eff
|
@@ -9,7 +9,7 @@ module RubyTerminalGames
|
|
9
9
|
|
10
10
|
def guess!(key)
|
11
11
|
return true if won?
|
12
|
-
|
12
|
+
|
13
13
|
found = false
|
14
14
|
letters.each_with_index do |letter, index|
|
15
15
|
next unless letter == key
|
@@ -26,7 +26,10 @@ module RubyTerminalGames
|
|
26
26
|
private
|
27
27
|
|
28
28
|
def random_word
|
29
|
-
File.
|
29
|
+
path = File.expand_path(
|
30
|
+
File.join(File.dirname(__FILE__), "words.txt"))
|
31
|
+
|
32
|
+
File.readlines(path)
|
30
33
|
.map { |line|
|
31
34
|
line.strip.downcase
|
32
35
|
}.reject { |w| w.empty? }.sample
|