word_scramble 0.0.2 → 0.0.3
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.
- data/README.md +2 -0
- data/lib/word_scramble/version.rb +1 -1
- data/lib/word_scramble.rb +8 -1
- data/spec/descrambler_spec.rb +1 -6
- metadata +3 -3
data/README.md
CHANGED
data/lib/word_scramble.rb
CHANGED
|
@@ -20,7 +20,14 @@ require "word_scramble/version"
|
|
|
20
20
|
# descrambler.matching_words # => ["airplane", ... ]
|
|
21
21
|
|
|
22
22
|
module WordScramble
|
|
23
|
-
DICTIONARY_PATH = '/etc/dictionaries-common/words'
|
|
23
|
+
DICTIONARY_PATH = if File.exists?('/etc/dictionaries-common/words')
|
|
24
|
+
'/etc/dictionaries-common/words'
|
|
25
|
+
elsif File.exists?('/usr/share/dict/words')
|
|
26
|
+
'/usr/share/dict/words'
|
|
27
|
+
else
|
|
28
|
+
raise "no dictionary file found"
|
|
29
|
+
end
|
|
30
|
+
|
|
24
31
|
DICTIONARY = File.open(DICTIONARY_PATH) do |f|
|
|
25
32
|
dictionary = []
|
|
26
33
|
f.each_line do |line|
|
data/spec/descrambler_spec.rb
CHANGED
|
@@ -8,11 +8,6 @@ describe WordScramble::Descrambler do
|
|
|
8
8
|
descrambled.should include("hello")
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
it "descrambles valesages" do
|
|
12
|
-
@scrambled = "valesages"
|
|
13
|
-
descrambled.should include("salvages")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
11
|
it "descrambles liopt" do
|
|
17
12
|
@scrambled = "liopt"
|
|
18
13
|
descrambled.should include("pilot")
|
|
@@ -25,7 +20,7 @@ describe WordScramble::Descrambler do
|
|
|
25
20
|
|
|
26
21
|
it "orders the matching words by length" do
|
|
27
22
|
@scrambled = "liopt"
|
|
28
|
-
descrambled.first.should == "pilot"
|
|
23
|
+
descrambled.first.downcase.should == "pilot"
|
|
29
24
|
end
|
|
30
25
|
|
|
31
26
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: word_scramble
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -13,7 +13,7 @@ date: 2012-04-11 00:00:00.000000000 Z
|
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &68903840 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,7 +21,7 @@ dependencies:
|
|
|
21
21
|
version: '0'
|
|
22
22
|
type: :development
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *68903840
|
|
25
25
|
description: Take a string of scrambled characters and find all the words that can
|
|
26
26
|
be made from those characters.
|
|
27
27
|
email:
|