jebediah 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jebediah.rb +6 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65156594909c339c72e889552c4ab526ccb3cfc3
4
- data.tar.gz: 1957eaecb4b60820b57390a086e670b64decb0a0
3
+ metadata.gz: 3e5683dce55e78114f7648d1fe1fd30b39225c13
4
+ data.tar.gz: d4e550b81a724f2d71e650dfa92adc6326a3e21b
5
5
  SHA512:
6
- metadata.gz: ea17b8636c130ddf20c474bbeef9f5a108748e7986f8f2d7fffde6524100cc1e12fd4fc448825f038d3b463e923665241870b6289cfdf459af77b561d3fbffb4
7
- data.tar.gz: 9a97c11e631d2ef7eeaeff005f6b7e0bd9bf54f73b5d74b7137c15fc9445420b0ab115e057cf0a25ca169c7a7b587c65bc3cd75b6d48fb9ecd9aadfb2396b96c
6
+ metadata.gz: 1a2a2e47295f0163acbdf2f68e99b2c1c90dd3a7c5c01ce28d49facc08de677cf1286efa904bdc7a6187edd672a66946548534ea46a22778c3223347d556cc84
7
+ data.tar.gz: 5e4f98120bc4a6e785b4b43033c9275d9a324f09373f7e32eb1fe2ae781970694a5f6a2f95a7bff794b364e221353a7bf9005aae43f4266b43cbf240375a885a
@@ -1,6 +1,6 @@
1
1
  class Jebediah
2
2
  def self.version
3
- return "1.0.5"
3
+ return "1.0.6"
4
4
  end
5
5
 
6
6
  def initialize(dictPaths=nil)
@@ -159,7 +159,9 @@ class Jebediah
159
159
  end
160
160
 
161
161
  def longestMatchInDictionary(words, dict)
162
- words.count.times.map { |n| words[0..n].join("-") }.select { |phrase| dict.include?(phrase) }.last.split("-")
162
+ hyphenated = words.count.times.map { |n| words[0..n].join("-") }
163
+ in_dictionary = hyphenated.select { |phrase| dict.include?(phrase) }
164
+ in_dictionary.last.split("-") rescue nil
163
165
  end
164
166
 
165
167
  def dehyphenatePhrase(phrase)
@@ -168,6 +170,8 @@ class Jebediah
168
170
  @dictionaries.each do |dict|
169
171
  return nil if phrase.empty?
170
172
  match = longestMatchInDictionary(phrase, dict)
173
+ return nil if match.nil?
174
+
171
175
  split << match.join("-")
172
176
  phrase = phrase[match.count .. -1]
173
177
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jebediah
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Acres