gemwarrior 0.9.21 → 0.9.22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94628a3d356ed158ed51481416e444b112791db7
4
- data.tar.gz: cdbdbba0955d78638e3e20cd37ad146465edf5ac
3
+ metadata.gz: b597259ded305d57bc41028e2129e454140255ba
4
+ data.tar.gz: 44653fe9f3c4f48c62d1fb93a8c872375539da68
5
5
  SHA512:
6
- metadata.gz: 7eb29f7a90ec1d667a35a14a4a51ee77f9562601184ca2b1f9b27632b3493b26ac3f1265691cb463fadb4eb1882217525ceecca1bf7a36a06e7651610f3c2d11
7
- data.tar.gz: eebf77c6e7c393394be3a430817b084169d6a53d900c590cb1b4ea474276408c813844434e04802dd72db7f5fbad33ed1d980222c15f6aec337f708e2676a46d
6
+ metadata.gz: 335f48a60bfd59529f6aa07f3ddc1c8b014add206f872b7664ed092bda7f66de7d6e5e4e62d6638699f50270205a9a0c4650174c95cc6a060290db5f030015ba
7
+ data.tar.gz: 6c1a36f12a20ee9c6af50034b3e32e5842c811ec73a3c2d30d721c3f8cdacf506b9720115485f6c29ee728ddd3b9f170d7ea6b55b3edf03e63a2dd7004947f8d
data/bin/gemwarrior CHANGED
File without changes
@@ -39,7 +39,7 @@ module Gemwarrior
39
39
  print_switches(self.switches)
40
40
 
41
41
  puts
42
- puts 'You can change the words themselves and you can push the large gem. What do you do?'
42
+ puts 'You can rearrange the letters in the words themselves, and you can push the large gem. What do you do?'
43
43
  puts
44
44
  puts '>> 1 Rearrange the letters in switch 1\'s word'
45
45
  puts '>> 2 Rearrange the letters in switch 2\'s word'
@@ -53,49 +53,43 @@ module Gemwarrior
53
53
 
54
54
  print '> '
55
55
  choice = gets.chomp!
56
-
56
+
57
57
  case choice
58
58
  when '1'
59
59
  switch1 = switches[0][2].nil? ? switches[0][1] : switches[0][2]
60
60
  puts "Switch 1: #{switch1}"
61
61
  puts 'What should the switch\'s word be set to?'
62
- new_word = gets.chomp!
63
- switches[0][2] = new_word
62
+ switches[0][2] = get_new_word(switch1)
64
63
  when '2'
65
64
  switch2 = switches[1][2].nil? ? switches[1][1] : switches[1][2]
66
65
  puts "Switch 2: #{switch2}"
67
66
  puts 'What should the switch\'s word be set to?'
68
- new_word = gets.chomp!
69
- switches[1][2] = new_word
67
+ switches[1][2] = get_new_word(switch2)
70
68
  when '3'
71
69
  switch3 = switches[2][2].nil? ? switches[2][1] : switches[2][2]
72
70
  puts "Switch 3: #{switch3}"
73
71
  puts 'What should the switch\'s word be set to?'
74
- new_word = gets.chomp!
75
- switches[2][2] = new_word
72
+ switches[2][2] = get_new_word(switch3)
76
73
  when '4'
77
74
  switch4 = switches[3][2].nil? ? switches[3][1] : switches[3][2]
78
75
  puts "Switch 4: #{switch4}"
79
76
  puts 'What should the switch\'s word be set to?'
80
- new_word = gets.chomp!
81
- switches[3][2] = new_word
77
+ switches[3][2] = get_new_word(switch4)
82
78
  when '5'
83
79
  switch5 = switches[4][2].nil? ? switches[4][1] : switches[4][2]
84
80
  puts "Switch 5: #{switch5}"
85
81
  puts 'What should the switch\'s word be set to?'
86
- new_word = gets.chomp!
87
- switches[4][2] = new_word
82
+ switches[4][2] = get_new_word(switch5)
88
83
  when '6'
89
84
  switch6 = switches[5][2].nil? ? switches[5][1] : switches[5][2]
90
85
  puts "Switch 6: #{switch6}"
91
86
  puts 'What should the switch\'s word be set to?'
92
- new_word = gets.chomp!
93
- switches[5][2] = new_word
87
+ switches[5][2] = get_new_word(switch6)
94
88
  when '7'
95
89
  pedestal_configured = true
96
90
 
97
91
  for i in 0..switches.length-1 do
98
- pedestal_configured = false unless switches[i][0].eql? switches[i][2]
92
+ pedestal_configured = false unless switches[i][0].downcase.eql? switches[i][2].downcase
99
93
  end
100
94
 
101
95
  if pedestal_configured
@@ -145,5 +139,15 @@ module Gemwarrior
145
139
  def jumble(word)
146
140
  word.split(//).sort_by { rand }.join('')
147
141
  end
142
+
143
+ def get_new_word(switch)
144
+ new_word = gets.chomp!
145
+ if switch.downcase.split(//).sort == new_word.downcase.split(//).sort
146
+ return new_word
147
+ else
148
+ puts 'Those letters are not in the original word, sorry.'.colorize(:red)
149
+ return nil
150
+ end
151
+ end
148
152
  end
149
153
  end
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.9.21'
5
+ VERSION = '0.9.22'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.21
4
+ version: 0.9.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-10 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -308,4 +308,6 @@ rubygems_version: 2.4.8
308
308
  signing_key:
309
309
  specification_version: 4
310
310
  summary: RubyGem text adventure
311
- test_files: []
311
+ test_files:
312
+ - spec/rubywarrior_spec.rb
313
+ - spec/spec_helper.rb