fat_core 0.1.4 → 0.1.5
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/fat_core/string.rb +2 -2
- data/lib/fat_core/version.rb +1 -1
- data/spec/lib/string_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d22516b0bf188041482f977b10cdb47002481d2f
|
4
|
+
data.tar.gz: 3c509e5d76c26c2f448a926ab2e96dd845fbb0fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30675764560f16415003789d5b00feabaa4f6e6ca94f32f53dc757795460b8c3d9756c2d88ed28073f49eb349fb765d443773118a90aada1b02fa94a2cb22c89
|
7
|
+
data.tar.gz: 2e1c3bda9a0d99f0750037508b0ceee1fe4a40ed5433fc57005f058b2d4b062dd5aa09757e25577ca5dafa4f66afe8cc3a7b42d23a937d7a50b55af80a6308b8
|
data/lib/fat_core/string.rb
CHANGED
@@ -4,8 +4,8 @@ class String
|
|
4
4
|
# portion of self. Other cannot be a regex embedded in a string.
|
5
5
|
def fuzzy_match(other)
|
6
6
|
# Remove periods, commas, and apostrophes
|
7
|
-
other = other.gsub(/[
|
8
|
-
target = self.gsub(/[
|
7
|
+
other = other.gsub(/[\*.,']/, '')
|
8
|
+
target = self.gsub(/[\*.,']/, '')
|
9
9
|
matched_text = nil
|
10
10
|
matchers = other.split(/[: ]+/)
|
11
11
|
regexp_string = matchers.map {|m| ".*?#{Regexp.escape(m)}.*?"}.join('[: ]')
|
data/lib/fat_core/version.rb
CHANGED
data/spec/lib/string_spec.rb
CHANGED
@@ -118,6 +118,7 @@ the people, for the people, shall not perish from the earth."
|
|
118
118
|
expect("St. Luke's".fuzzy_match('st lukes')).to eq('St Lukes')
|
119
119
|
expect("St Lukes".fuzzy_match('st. luke\'s')).to eq('St Lukes')
|
120
120
|
expect("St Lukes, Inc.".fuzzy_match('st luke inc')).to eq('St Lukes Inc')
|
121
|
+
expect("E*TRADE".fuzzy_match('etrade')).to eq('ETRADE')
|
121
122
|
end
|
122
123
|
|
123
124
|
it "should be able to properly capitalize a string as a title" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fat_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel E. Doherty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|