fuzzily 0.2.3 → 0.2.4

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: 173f23b097720f4ab64080adba9dd9d1aa4f9de9
4
- data.tar.gz: 5312ce068351b2db5f5acaecd3a040cf6a3bddbc
3
+ metadata.gz: 7405e2a5492b3d3ebc3a3af29130fe2b105d9d00
4
+ data.tar.gz: cff5f7936cdd377ba57975341457e1a9c3941038
5
5
  SHA512:
6
- metadata.gz: 030d7aed45fcc823b8f56e60f24e01570125d4ec41dc3be72cbacbffd915d7d6f4ef129a29525ebafcc93267766f4e6652db94740851e93aa4ad9c80abc4f826
7
- data.tar.gz: 41c23a925ea4bec80ea1fb77087f6add430145e98d49590a36eb0162e5eb26902dcbaeb4eb39be551da51c7db7ea3cf355eec8acf3c5c5f297badb97a2fe898c
6
+ metadata.gz: b42bc03dbc0e11415ba757ee9e5dd56e99055def2a368d82968ec7fcb30a3eab90c9f0065b4b0ad5e10bbc0176b31c4998a0dcd976e10809a45bb2e4e0e069cd
7
+ data.tar.gz: bc411000aedc0213f1b884080406fb8d611bb24169d10a852d04f29015051e150230e49277be2885cf0248211e95eda7ec8afeffe9db52a17636b49b3c80741a
@@ -1 +1 @@
1
- 1.9.2-p320
1
+ 2.0.0-p247
@@ -10,6 +10,13 @@ gemfile:
10
10
  - gemfiles/rails32.gemfile
11
11
  - gemfiles/rails32_pg.gemfile
12
12
  - gemfiles/rails32_mysql.gemfile
13
+ before_install: bundle install
14
+ bundler_args:
15
+ matrix:
16
+ exclude:
17
+ - rvm: 2.0.0
18
+ gemfile: gemfiles/rails23.gemfile
19
+ env: TRAVIS=TRUE
13
20
  before_script:
14
21
  - psql -c 'create database fuzzily_test;' -U postgres
15
22
  - mysql -e 'create database fuzzily_test;'
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source ENV.fetch('GEM_SOURCE','https://rubygems.org')
2
2
 
3
3
  # Specify your gem's dependencies in fuzzily.gemspec
4
4
  gemspec
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fuzzily (0.2.3)
4
+ fuzzily (0.2.4)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
8
- remote: https://rubygems.org/
8
+ remote: http://yarp.dev/
9
9
  specs:
10
- activemodel (3.2.13)
11
- activesupport (= 3.2.13)
10
+ activemodel (3.2.14)
11
+ activesupport (= 3.2.14)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.13)
14
- activemodel (= 3.2.13)
15
- activesupport (= 3.2.13)
13
+ activerecord (3.2.14)
14
+ activemodel (= 3.2.14)
15
+ activesupport (= 3.2.14)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.13)
19
- i18n (= 0.6.1)
18
+ activesupport (3.2.14)
19
+ i18n (~> 0.6, >= 0.6.4)
20
20
  multi_json (~> 1.0)
21
21
  appraisal (0.5.2)
22
22
  bundler
@@ -32,10 +32,10 @@ GEM
32
32
  simplecov (>= 0.7)
33
33
  thor
34
34
  diff-lcs (1.2.4)
35
- i18n (0.6.1)
35
+ i18n (0.6.5)
36
36
  method_source (0.8.1)
37
37
  mime-types (1.23)
38
- multi_json (1.7.2)
38
+ multi_json (1.7.9)
39
39
  mysql2 (0.3.11)
40
40
  pg (0.15.1)
41
41
  pry (0.9.12.1)
@@ -44,7 +44,7 @@ GEM
44
44
  slop (~> 3.4)
45
45
  pry-nav (0.2.3)
46
46
  pry (~> 0.9.10)
47
- rake (10.0.4)
47
+ rake (10.1.0)
48
48
  rest-client (1.6.7)
49
49
  mime-types (>= 1.16)
50
50
  rspec (2.13.0)
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Julien Letessier
1
+ Copyright (c) 2012 HouseTrip Ltd
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -120,6 +120,8 @@ columns in any version.
120
120
 
121
121
  MIT licence. Quite permissive if you ask me.
122
122
 
123
+ Copyright (c) 2013 HouseTrip Ltd.
124
+
123
125
  ## Contributing
124
126
 
125
127
  1. Fork it
@@ -10,7 +10,8 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["julien.letessier@gmail.com"]
11
11
  gem.description = %q{Fast fuzzy string matching for rails}
12
12
  gem.summary = %q{A fast, trigram-based, database-backed fuzzy string search/match engine for Rails.}
13
- gem.homepage = ""
13
+ gem.homepage = "http://github.com/mezis/fuzzily"
14
+ gem.license = 'MIT'
14
15
 
15
16
  gem.add_runtime_dependency 'activerecord', '>= 2.3.17'
16
17
 
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: /Users/mezis/Dropbox/Development/fuzzily
3
3
  specs:
4
- fuzzily (0.2.3)
4
+ fuzzily (0.2.4)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activerecord (2.3.17)
11
- activesupport (= 2.3.17)
12
- activesupport (2.3.17)
10
+ activerecord (2.3.18)
11
+ activesupport (= 2.3.18)
12
+ activesupport (2.3.18)
13
13
  appraisal (0.5.2)
14
14
  bundler
15
15
  rake
@@ -22,28 +22,28 @@ GEM
22
22
  simplecov (>= 0.7)
23
23
  thor
24
24
  diff-lcs (1.2.4)
25
- method_source (0.8.1)
26
- mime-types (1.23)
27
- multi_json (1.7.2)
28
- mysql2 (0.3.11)
29
- pg (0.15.1)
30
- pry (0.9.12.1)
25
+ method_source (0.8.2)
26
+ mime-types (1.25)
27
+ multi_json (1.7.9)
28
+ mysql2 (0.3.13)
29
+ pg (0.16.0)
30
+ pry (0.9.12.2)
31
31
  coderay (~> 1.0.5)
32
32
  method_source (~> 0.8)
33
33
  slop (~> 3.4)
34
34
  pry-nav (0.2.3)
35
35
  pry (~> 0.9.10)
36
- rake (10.0.4)
36
+ rake (10.1.0)
37
37
  rest-client (1.6.7)
38
38
  mime-types (>= 1.16)
39
- rspec (2.13.0)
40
- rspec-core (~> 2.13.0)
41
- rspec-expectations (~> 2.13.0)
42
- rspec-mocks (~> 2.13.0)
43
- rspec-core (2.13.1)
44
- rspec-expectations (2.13.0)
39
+ rspec (2.14.1)
40
+ rspec-core (~> 2.14.0)
41
+ rspec-expectations (~> 2.14.0)
42
+ rspec-mocks (~> 2.14.0)
43
+ rspec-core (2.14.5)
44
+ rspec-expectations (2.14.2)
45
45
  diff-lcs (>= 1.1.3, < 2.0)
46
- rspec-mocks (2.13.1)
46
+ rspec-mocks (2.14.3)
47
47
  simplecov (0.7.1)
48
48
  multi_json (~> 1.0)
49
49
  simplecov-html (~> 0.7.1)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mezis/Dropbox/Development/fuzzily
3
3
  specs:
4
- fuzzily (0.2.2)
4
+ fuzzily (0.2.4)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
@@ -32,34 +32,34 @@ GEM
32
32
  thor
33
33
  diff-lcs (1.2.4)
34
34
  i18n (0.5.0)
35
- method_source (0.8.1)
36
- mime-types (1.23)
37
- multi_json (1.7.2)
38
- mysql2 (0.3.11)
39
- pg (0.15.1)
40
- pry (0.9.12.1)
35
+ method_source (0.8.2)
36
+ mime-types (1.25)
37
+ multi_json (1.7.9)
38
+ mysql2 (0.3.13)
39
+ pg (0.16.0)
40
+ pry (0.9.12.2)
41
41
  coderay (~> 1.0.5)
42
42
  method_source (~> 0.8)
43
43
  slop (~> 3.4)
44
44
  pry-nav (0.2.3)
45
45
  pry (~> 0.9.10)
46
- rake (10.0.4)
46
+ rake (10.1.0)
47
47
  rest-client (1.6.7)
48
48
  mime-types (>= 1.16)
49
- rspec (2.13.0)
50
- rspec-core (~> 2.13.0)
51
- rspec-expectations (~> 2.13.0)
52
- rspec-mocks (~> 2.13.0)
53
- rspec-core (2.13.1)
54
- rspec-expectations (2.13.0)
49
+ rspec (2.14.1)
50
+ rspec-core (~> 2.14.0)
51
+ rspec-expectations (~> 2.14.0)
52
+ rspec-mocks (~> 2.14.0)
53
+ rspec-core (2.14.5)
54
+ rspec-expectations (2.14.2)
55
55
  diff-lcs (>= 1.1.3, < 2.0)
56
- rspec-mocks (2.13.1)
56
+ rspec-mocks (2.14.3)
57
57
  simplecov (0.7.1)
58
58
  multi_json (~> 1.0)
59
59
  simplecov-html (~> 0.7.1)
60
60
  simplecov-html (0.7.1)
61
- slop (3.4.4)
62
- sqlite3 (1.3.7)
61
+ slop (3.4.6)
62
+ sqlite3 (1.3.8)
63
63
  thor (0.18.1)
64
64
  tzinfo (0.3.37)
65
65
 
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: /Users/mezis/Dropbox/Development/fuzzily
3
3
  specs:
4
- fuzzily (0.2.2)
4
+ fuzzily (0.2.4)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.1.11)
11
- activesupport (= 3.1.11)
10
+ activemodel (3.1.12)
11
+ activesupport (= 3.1.12)
12
12
  builder (~> 3.0.0)
13
13
  i18n (~> 0.6)
14
- activerecord (3.1.11)
15
- activemodel (= 3.1.11)
16
- activesupport (= 3.1.11)
14
+ activerecord (3.1.12)
15
+ activemodel (= 3.1.12)
16
+ activesupport (= 3.1.12)
17
17
  arel (~> 2.2.3)
18
18
  tzinfo (~> 0.3.29)
19
- activesupport (3.1.11)
19
+ activesupport (3.1.12)
20
20
  multi_json (~> 1.0)
21
21
  appraisal (0.5.2)
22
22
  bundler
@@ -32,35 +32,35 @@ GEM
32
32
  simplecov (>= 0.7)
33
33
  thor
34
34
  diff-lcs (1.2.4)
35
- i18n (0.6.4)
36
- method_source (0.8.1)
37
- mime-types (1.23)
38
- multi_json (1.7.2)
39
- mysql2 (0.3.11)
40
- pg (0.15.1)
41
- pry (0.9.12.1)
35
+ i18n (0.6.5)
36
+ method_source (0.8.2)
37
+ mime-types (1.25)
38
+ multi_json (1.7.9)
39
+ mysql2 (0.3.13)
40
+ pg (0.16.0)
41
+ pry (0.9.12.2)
42
42
  coderay (~> 1.0.5)
43
43
  method_source (~> 0.8)
44
44
  slop (~> 3.4)
45
45
  pry-nav (0.2.3)
46
46
  pry (~> 0.9.10)
47
- rake (10.0.4)
47
+ rake (10.1.0)
48
48
  rest-client (1.6.7)
49
49
  mime-types (>= 1.16)
50
- rspec (2.13.0)
51
- rspec-core (~> 2.13.0)
52
- rspec-expectations (~> 2.13.0)
53
- rspec-mocks (~> 2.13.0)
54
- rspec-core (2.13.1)
55
- rspec-expectations (2.13.0)
50
+ rspec (2.14.1)
51
+ rspec-core (~> 2.14.0)
52
+ rspec-expectations (~> 2.14.0)
53
+ rspec-mocks (~> 2.14.0)
54
+ rspec-core (2.14.5)
55
+ rspec-expectations (2.14.2)
56
56
  diff-lcs (>= 1.1.3, < 2.0)
57
- rspec-mocks (2.13.1)
57
+ rspec-mocks (2.14.3)
58
58
  simplecov (0.7.1)
59
59
  multi_json (~> 1.0)
60
60
  simplecov-html (~> 0.7.1)
61
61
  simplecov-html (0.7.1)
62
- slop (3.4.4)
63
- sqlite3 (1.3.7)
62
+ slop (3.4.6)
63
+ sqlite3 (1.3.8)
64
64
  thor (0.18.1)
65
65
  tzinfo (0.3.37)
66
66
 
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: /Users/mezis/Dropbox/Development/fuzzily
3
3
  specs:
4
- fuzzily (0.2.3)
4
+ fuzzily (0.2.4)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.13)
11
- activesupport (= 3.2.13)
10
+ activemodel (3.2.14)
11
+ activesupport (= 3.2.14)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.13)
14
- activemodel (= 3.2.13)
15
- activesupport (= 3.2.13)
13
+ activerecord (3.2.14)
14
+ activemodel (= 3.2.14)
15
+ activesupport (= 3.2.14)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.13)
19
- i18n (= 0.6.1)
18
+ activesupport (3.2.14)
19
+ i18n (~> 0.6, >= 0.6.4)
20
20
  multi_json (~> 1.0)
21
21
  appraisal (0.5.2)
22
22
  bundler
@@ -32,35 +32,35 @@ GEM
32
32
  simplecov (>= 0.7)
33
33
  thor
34
34
  diff-lcs (1.2.4)
35
- i18n (0.6.1)
36
- method_source (0.8.1)
37
- mime-types (1.23)
38
- multi_json (1.7.2)
39
- mysql2 (0.3.11)
40
- pg (0.15.1)
41
- pry (0.9.12.1)
35
+ i18n (0.6.5)
36
+ method_source (0.8.2)
37
+ mime-types (1.25)
38
+ multi_json (1.7.9)
39
+ mysql2 (0.3.13)
40
+ pg (0.16.0)
41
+ pry (0.9.12.2)
42
42
  coderay (~> 1.0.5)
43
43
  method_source (~> 0.8)
44
44
  slop (~> 3.4)
45
45
  pry-nav (0.2.3)
46
46
  pry (~> 0.9.10)
47
- rake (10.0.4)
47
+ rake (10.1.0)
48
48
  rest-client (1.6.7)
49
49
  mime-types (>= 1.16)
50
- rspec (2.13.0)
51
- rspec-core (~> 2.13.0)
52
- rspec-expectations (~> 2.13.0)
53
- rspec-mocks (~> 2.13.0)
54
- rspec-core (2.13.1)
55
- rspec-expectations (2.13.0)
50
+ rspec (2.14.1)
51
+ rspec-core (~> 2.14.0)
52
+ rspec-expectations (~> 2.14.0)
53
+ rspec-mocks (~> 2.14.0)
54
+ rspec-core (2.14.5)
55
+ rspec-expectations (2.14.2)
56
56
  diff-lcs (>= 1.1.3, < 2.0)
57
- rspec-mocks (2.13.1)
57
+ rspec-mocks (2.14.3)
58
58
  simplecov (0.7.1)
59
59
  multi_json (~> 1.0)
60
60
  simplecov-html (~> 0.7.1)
61
61
  simplecov-html (0.7.1)
62
- slop (3.4.4)
63
- sqlite3 (1.3.7)
62
+ slop (3.4.6)
63
+ sqlite3 (1.3.8)
64
64
  thor (0.18.1)
65
65
  tzinfo (0.3.37)
66
66
 
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: /Users/mezis/Dropbox/Development/fuzzily
3
3
  specs:
4
- fuzzily (0.2.3)
4
+ fuzzily (0.2.4)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.13)
11
- activesupport (= 3.2.13)
10
+ activemodel (3.2.14)
11
+ activesupport (= 3.2.14)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.13)
14
- activemodel (= 3.2.13)
15
- activesupport (= 3.2.13)
13
+ activerecord (3.2.14)
14
+ activemodel (= 3.2.14)
15
+ activesupport (= 3.2.14)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.13)
19
- i18n (= 0.6.1)
18
+ activesupport (3.2.14)
19
+ i18n (~> 0.6, >= 0.6.4)
20
20
  multi_json (~> 1.0)
21
21
  appraisal (0.5.2)
22
22
  bundler
@@ -32,35 +32,35 @@ GEM
32
32
  simplecov (>= 0.7)
33
33
  thor
34
34
  diff-lcs (1.2.4)
35
- i18n (0.6.1)
36
- method_source (0.8.1)
37
- mime-types (1.23)
38
- multi_json (1.7.2)
39
- mysql2 (0.3.11)
40
- pg (0.15.1)
41
- pry (0.9.12.1)
35
+ i18n (0.6.5)
36
+ method_source (0.8.2)
37
+ mime-types (1.25)
38
+ multi_json (1.7.9)
39
+ mysql2 (0.3.13)
40
+ pg (0.16.0)
41
+ pry (0.9.12.2)
42
42
  coderay (~> 1.0.5)
43
43
  method_source (~> 0.8)
44
44
  slop (~> 3.4)
45
45
  pry-nav (0.2.3)
46
46
  pry (~> 0.9.10)
47
- rake (10.0.4)
47
+ rake (10.1.0)
48
48
  rest-client (1.6.7)
49
49
  mime-types (>= 1.16)
50
- rspec (2.13.0)
51
- rspec-core (~> 2.13.0)
52
- rspec-expectations (~> 2.13.0)
53
- rspec-mocks (~> 2.13.0)
54
- rspec-core (2.13.1)
55
- rspec-expectations (2.13.0)
50
+ rspec (2.14.1)
51
+ rspec-core (~> 2.14.0)
52
+ rspec-expectations (~> 2.14.0)
53
+ rspec-mocks (~> 2.14.0)
54
+ rspec-core (2.14.5)
55
+ rspec-expectations (2.14.2)
56
56
  diff-lcs (>= 1.1.3, < 2.0)
57
- rspec-mocks (2.13.1)
57
+ rspec-mocks (2.14.3)
58
58
  simplecov (0.7.1)
59
59
  multi_json (~> 1.0)
60
60
  simplecov-html (~> 0.7.1)
61
61
  simplecov-html (0.7.1)
62
- slop (3.4.4)
63
- sqlite3 (1.3.7)
62
+ slop (3.4.6)
63
+ sqlite3 (1.3.8)
64
64
  thor (0.18.1)
65
65
  tzinfo (0.3.37)
66
66
 
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: /Users/mezis/Dropbox/Development/fuzzily
3
3
  specs:
4
- fuzzily (0.2.3)
4
+ fuzzily (0.2.4)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.13)
11
- activesupport (= 3.2.13)
10
+ activemodel (3.2.14)
11
+ activesupport (= 3.2.14)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.13)
14
- activemodel (= 3.2.13)
15
- activesupport (= 3.2.13)
13
+ activerecord (3.2.14)
14
+ activemodel (= 3.2.14)
15
+ activesupport (= 3.2.14)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.13)
19
- i18n (= 0.6.1)
18
+ activesupport (3.2.14)
19
+ i18n (~> 0.6, >= 0.6.4)
20
20
  multi_json (~> 1.0)
21
21
  appraisal (0.5.2)
22
22
  bundler
@@ -32,35 +32,35 @@ GEM
32
32
  simplecov (>= 0.7)
33
33
  thor
34
34
  diff-lcs (1.2.4)
35
- i18n (0.6.1)
36
- method_source (0.8.1)
37
- mime-types (1.23)
38
- multi_json (1.7.2)
39
- mysql2 (0.3.11)
40
- pg (0.15.1)
41
- pry (0.9.12.1)
35
+ i18n (0.6.5)
36
+ method_source (0.8.2)
37
+ mime-types (1.25)
38
+ multi_json (1.7.9)
39
+ mysql2 (0.3.13)
40
+ pg (0.16.0)
41
+ pry (0.9.12.2)
42
42
  coderay (~> 1.0.5)
43
43
  method_source (~> 0.8)
44
44
  slop (~> 3.4)
45
45
  pry-nav (0.2.3)
46
46
  pry (~> 0.9.10)
47
- rake (10.0.4)
47
+ rake (10.1.0)
48
48
  rest-client (1.6.7)
49
49
  mime-types (>= 1.16)
50
- rspec (2.13.0)
51
- rspec-core (~> 2.13.0)
52
- rspec-expectations (~> 2.13.0)
53
- rspec-mocks (~> 2.13.0)
54
- rspec-core (2.13.1)
55
- rspec-expectations (2.13.0)
50
+ rspec (2.14.1)
51
+ rspec-core (~> 2.14.0)
52
+ rspec-expectations (~> 2.14.0)
53
+ rspec-mocks (~> 2.14.0)
54
+ rspec-core (2.14.5)
55
+ rspec-expectations (2.14.2)
56
56
  diff-lcs (>= 1.1.3, < 2.0)
57
- rspec-mocks (2.13.1)
57
+ rspec-mocks (2.14.3)
58
58
  simplecov (0.7.1)
59
59
  multi_json (~> 1.0)
60
60
  simplecov-html (~> 0.7.1)
61
61
  simplecov-html (0.7.1)
62
- slop (3.4.4)
63
- sqlite3 (1.3.7)
62
+ slop (3.4.6)
63
+ sqlite3 (1.3.8)
64
64
  thor (0.18.1)
65
65
  tzinfo (0.3.37)
66
66
 
@@ -75,6 +75,7 @@ module Fuzzily
75
75
 
76
76
  trigram_class.transaction do
77
77
  batch.each { |record| record.send(trigram_association).delete_all }
78
+ break if inserts.empty?
78
79
 
79
80
  if supports_bulk_inserts
80
81
  trigram_class.connection.insert(insert_sql + inserts.join(", "))
@@ -4,6 +4,7 @@ module Fuzzily
4
4
  class String < SimpleDelegator
5
5
 
6
6
  def trigrams
7
+ return [] if __getobj__.nil?
7
8
  normalized = self.normalize
8
9
  number_of_trigrams = normalized.length - 3
9
10
  trigrams = (0..number_of_trigrams).map { |index| normalized[index,3] }.uniq
@@ -18,7 +19,6 @@ module Fuzzily
18
19
  # Remove accents, downcase, replace spaces and word start with '*',
19
20
  # return list of normalized words
20
21
  def normalize
21
- # Iconv.iconv('ascii//translit//ignore', 'utf-8', self).first.
22
22
  ActiveSupport::Multibyte::Chars.new(self).
23
23
  mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/,'').downcase.to_s.
24
24
  gsub(/[^a-z]/,' ').
@@ -1,3 +1,3 @@
1
1
  module Fuzzily
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -62,13 +62,22 @@ describe Fuzzily::Searchable do
62
62
  end
63
63
 
64
64
  describe '#update_fuzzy_<field>!' do
65
- it 're-creates trigrams' do
65
+ before do
66
66
  subject.fuzzily_searchable :name
67
+ end
68
+
69
+ it 're-creates trigrams' do
67
70
  subject.create(:name => 'Paris')
68
71
  old_ids = Trigram.all.map(&:id)
69
72
  subject.last.update_fuzzy_name!
70
73
  (old_ids & Trigram.all.map(&:id)).should be_empty
71
74
  end
75
+
76
+ it 'ignores nil values' do
77
+ subject.create(:name => nil)
78
+ subject.last.update_fuzzy_name!
79
+ Trigram.all.should be_empty
80
+ end
72
81
  end
73
82
 
74
83
  describe '.bulk_update_fuzzy_<field>' do
@@ -80,6 +89,13 @@ describe Fuzzily::Searchable do
80
89
  subject.bulk_update_fuzzy_name
81
90
  Trigram.all.should_not be_empty
82
91
  end
92
+
93
+ it 'ignores nil values' do
94
+ subject.create(:name => nil)
95
+ Trigram.delete_all
96
+ subject.bulk_update_fuzzy_name
97
+ Trigram.all.should be_empty
98
+ end
83
99
  end
84
100
 
85
101
  context '(integrationg test)' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuzzily
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-13 00:00:00.000000000 Z
11
+ date: 2013-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -192,8 +192,9 @@ files:
192
192
  - spec/fuzzily/trigram_spec.rb
193
193
  - spec/meta_spec.rb
194
194
  - spec/spec_helper.rb
195
- homepage: ''
196
- licenses: []
195
+ homepage: http://github.com/mezis/fuzzily
196
+ licenses:
197
+ - MIT
197
198
  metadata: {}
198
199
  post_install_message:
199
200
  rdoc_options: []