blurrily 0.1.0 → 0.2.0

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: 5278062ebce0b77e8f18ffebdefa1639cafc8b59
4
- data.tar.gz: 5ce39cb3bc008428947ff9ab234d8aba07455241
3
+ metadata.gz: 2fb2ab9e2c0e96d8a65f2a86ab5ccda4686cec85
4
+ data.tar.gz: 1cf52f8ba96a911f8e0ba140c87ff2ed50e68aac
5
5
  SHA512:
6
- metadata.gz: 28fdbf9009c005523e30c450fabb461fff877a4c86d37fe83096998f5ab1addd2d0d032c378f5333e553e27fe28aac9a500508967e64a7f0c33ecdc9c960fe06
7
- data.tar.gz: 5e9894f29ce68dfc5ceb222e38f8a05c138f5c7cdc770b8a6c0940b765d9ae4d983cc7ee3e74449b94136b696e65dec666de85cfa1aa2f8b2d38970b6add1fad
6
+ metadata.gz: f464ef07e4140191d33d14192eb32a5f39c6493b0709bd0bd3316b0e33b52de6b9cf9ed56bd961f3dd4c2d1078633a0be3007431587efb12e4c2f859310dd61f
7
+ data.tar.gz: 8b81f4c68be6b464f8d4408e458037c1602e6e448f658c6b2b333b5d8f83f8b6ddfa7fe849b244a0e61b11f6937b68a1b3189f9a417b14cdb97f002bb379f960
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Blurrily — Millisecond fuzzy string matching
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/blurrily.png)](http://badge.fury.io/rb/blurrily)
3
4
  [![Build Status](https://travis-ci.org/mezis/blurrily.png?branch=master)](https://travis-ci.org/mezis/blurrily)
4
5
  [![Dependency Status](https://gemnasium.com/mezis/blurrily.png)](https://gemnasium.com/mezis/blurrily)
5
6
  [![Code Climate](https://codeclimate.com/github/mezis/blurrily.png)](https://codeclimate.com/github/mezis/blurrily)
@@ -9,9 +10,10 @@
9
10
  > Here aresome photos of **Marrakesh**, Morroco.
10
11
  > Did you mean **Martanesh**, Albania, **Marakkanam**, India, or **Marasheshty**, Romania?
11
12
 
12
- Blurrily find missplet or partial needles in a haystack of strings, quickly.
13
- It scales well: its response time is typically 1-2ms on user-input datasets
14
- and 75-100ms on pathological datasets ([more](#Benchmarks)).
13
+ Blurrily finds misspelled, prefix, or partial needles in a haystack of
14
+ strings, quickly. It scales well: its response time is typically 1-2ms on
15
+ user-input datasets and 75-100ms on pathological datasets
16
+ ([more](#benchmarks)).
15
17
 
16
18
  Blurrily is compatible and tested with all MRI Rubies from 1.8.7 to 2.0.0.
17
19
  It is tested on Linux 2.6 (32bit and 64bit) and MacOS X 10.8.
@@ -210,7 +210,7 @@ void Init_map_ext(void) {
210
210
  eBlurrilyModule = rb_define_module("Blurrily");
211
211
  assert(eBlurrilyModule != Qnil);
212
212
 
213
- klass = rb_define_class_under(eBlurrilyModule, "Map", rb_cObject);
213
+ klass = rb_define_class_under(eBlurrilyModule, "RawMap", rb_cObject);
214
214
  assert(klass != Qnil);
215
215
 
216
216
  eClosedError = rb_define_class_under(klass, "ClosedError", rb_eRuntimeError);
@@ -3,24 +3,37 @@ require 'active_support/core_ext/module/aliasing' # alias_method_chain
3
3
  require 'active_support/core_ext/string/multibyte' # mb_chars
4
4
 
5
5
  module Blurrily
6
- Map.class_eval do
6
+ class Map < RawMap
7
7
 
8
- def put_with_string_normalize(needle, reference, weight=nil)
8
+ def put(needle, reference, weight=nil)
9
9
  weight ||= 0
10
10
  needle = normalize_string needle
11
- put_without_string_normalize(needle, reference, weight)
11
+ @clean_path = nil
12
+ super(needle, reference, weight)
12
13
  end
13
14
 
14
- alias_method_chain :put, :string_normalize
15
-
16
-
17
- def find_with_string_normalize(needle, limit=10)
15
+ def find(needle, limit=10)
18
16
  needle = normalize_string needle
19
- find_without_string_normalize(needle, limit)
17
+ super(needle, limit)
18
+ end
19
+
20
+ def delete(*args)
21
+ @clean_path = nil
22
+ super(*args)
20
23
  end
21
24
 
22
- alias_method_chain :find, :string_normalize
25
+ def save(path)
26
+ return if @clean_path == path
27
+ super(path)
28
+ @clean_path = path
29
+ nil
30
+ end
23
31
 
32
+ def self.load(path)
33
+ super(path).tap do |map|
34
+ map.instance_variable_set :@clean_path, path
35
+ end
36
+ end
24
37
 
25
38
  private
26
39
 
@@ -32,6 +45,5 @@ module Blurrily
32
45
  end
33
46
  result.gsub(/\s+/,' ').strip
34
47
  end
35
-
36
48
  end
37
49
  end
@@ -1,3 +1,3 @@
1
1
  module Blurrily
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blurrily
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
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-04-01 00:00:00.000000000 Z
11
+ date: 2013-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  version: '0'
269
269
  requirements: []
270
270
  rubyforge_project:
271
- rubygems_version: 2.0.0
271
+ rubygems_version: 2.0.3
272
272
  signing_key:
273
273
  specification_version: 4
274
274
  summary: Native fuzzy string search