picky 4.6.4 → 4.6.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.
- data/lib/picky/tokenizer.rb +15 -1
- data/spec/lib/tokenizer_spec.rb +14 -2
- metadata +4 -4
data/lib/picky/tokenizer.rb
CHANGED
@@ -184,7 +184,21 @@ Case sensitive? #{@case_sensitive ? "Yes." : "-"}
|
|
184
184
|
send method_name, value unless value.nil?
|
185
185
|
end
|
186
186
|
rescue NoMethodError => e
|
187
|
-
|
187
|
+
# TODO Print out valid options.
|
188
|
+
#
|
189
|
+
raise <<-ERROR
|
190
|
+
The option "#{e.name}" is not a valid option for a Picky tokenizer.
|
191
|
+
Please see https://github.com/floere/picky/wiki/Indexing-configuration for valid options.
|
192
|
+
A short overview:
|
193
|
+
removes_characters /regexp/
|
194
|
+
stopwords /regexp/
|
195
|
+
splits_text_on /regexp/ or "String", default /\s/
|
196
|
+
normalizes_words [[/replace (this)/, 'with this \\1'], ...]
|
197
|
+
rejects_token_if Proc/lambda, default :blank?.to_proc
|
198
|
+
substitutes_characters_with Picky::CharacterSubstituter or responds to #substitute(String)
|
199
|
+
case_sensitive true/false
|
200
|
+
|
201
|
+
ERROR
|
188
202
|
end
|
189
203
|
def default_options
|
190
204
|
{
|
data/spec/lib/tokenizer_spec.rb
CHANGED
@@ -8,7 +8,19 @@ describe Picky::Tokenizer do
|
|
8
8
|
it 'informs the user nicely' do
|
9
9
|
expect {
|
10
10
|
described_class.new rejetcs_token_if: :blank?.to_proc
|
11
|
-
}.to raise_error(
|
11
|
+
}.to raise_error(<<-MESSAGE)
|
12
|
+
The option "rejetcs_token_if" is not a valid option for a Picky tokenizer.
|
13
|
+
Please see https://github.com/floere/picky/wiki/Indexing-configuration for valid options.
|
14
|
+
A short overview:
|
15
|
+
removes_characters /regexp/
|
16
|
+
stopwords /regexp/
|
17
|
+
splits_text_on /regexp/ or "String", default /\s/
|
18
|
+
normalizes_words [[/replace (this)/, 'with this \\1'], ...]
|
19
|
+
rejects_token_if Proc/lambda, default :blank?.to_proc
|
20
|
+
substitutes_characters_with Picky::CharacterSubstituter or responds to #substitute(String)
|
21
|
+
case_sensitive true/false
|
22
|
+
|
23
|
+
MESSAGE
|
12
24
|
end
|
13
25
|
end
|
14
26
|
|
@@ -27,7 +39,7 @@ Removes characters: -
|
|
27
39
|
Stopwords: -
|
28
40
|
Splits text on: /\\s/
|
29
41
|
Normalizes words: -
|
30
|
-
Rejects tokens? Yes, see line
|
42
|
+
Rejects tokens? Yes, see line 28 in app/application.rb
|
31
43
|
Substitutes chars? -
|
32
44
|
Case sensitive? Yes.
|
33
45
|
EXPECTED
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.6.
|
4
|
+
version: 4.6.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 4.6.
|
37
|
+
version: 4.6.5
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 4.6.
|
45
|
+
version: 4.6.5
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: text
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|