lcbo 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/lib/lcbo/crawlkit/tag_helper.rb +22 -9
- data/lib/lcbo/version.rb +1 -1
- data/spec/crawlkit/tag_helper_spec.rb +2 -1
- data/spec/pages/product_pages.yml +2 -2
- data/spec/pages/store_pages.yml +1 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module LCBO
|
2
2
|
module CrawlKit
|
3
3
|
module TagHelper
|
4
|
-
DELETION_RE = /\
|
4
|
+
DELETION_RE = /\"|\\|\/|\(|\)|\[|\]|\./
|
5
5
|
WHITESPACE_RE = /\*|\+|\&|\_|\,|\s/
|
6
6
|
|
7
7
|
def self.flatten(values)
|
@@ -21,14 +21,27 @@ module LCBO
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.stem(word)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
split = lambda { |word|
|
25
|
+
if word.include?('-')
|
26
|
+
words = word.split('-')
|
27
|
+
a = words.dup
|
28
|
+
a << word
|
29
|
+
a << words.join
|
30
|
+
a
|
31
|
+
else
|
32
|
+
[word]
|
33
|
+
end
|
34
|
+
}
|
35
|
+
|
36
|
+
tokenize = lambda { |words|
|
37
|
+
words.reduce([]) do |tokens, word|
|
38
|
+
tokens << word
|
39
|
+
tokens << word.gsub("'", '') if word.include?("'")
|
40
|
+
tokens
|
41
|
+
end
|
42
|
+
}
|
43
|
+
|
44
|
+
tokenize.(split.(word))
|
32
45
|
end
|
33
46
|
|
34
47
|
def self.[](*values)
|
data/lib/lcbo/version.rb
CHANGED
@@ -6,8 +6,9 @@ describe LCBO::CrawlKit::TagHelper do
|
|
6
6
|
['Hello World'] => %w[hello world],
|
7
7
|
['Éve Picard'] => %w[éve picard eve],
|
8
8
|
['Hello Hello World'] => %w[hello world],
|
9
|
+
['É\'ve Picard-Rowe'] => %w[é've éve picard rowe picard-rowe picardrowe e've eve],
|
9
10
|
['Hello', 'Éve Picard'] => %w[hello éve picard eve],
|
10
|
-
['Hello', 'Éve-Picard'] => %w[hello éve picard évepicard eve evepicard],
|
11
|
+
['Hello', 'Éve-Picard'] => %w[hello éve picard éve-picard évepicard eve eve-picard evepicard],
|
11
12
|
['Hello', nil, 'World'] => %w[hello world]
|
12
13
|
}
|
13
14
|
|
@@ -48,7 +48,7 @@
|
|
48
48
|
:expectation:
|
49
49
|
:id: 18
|
50
50
|
:name: Heineken Lager
|
51
|
-
:tags: ["heineken", "lager", "beer", "netherlands", "heinekens", "brouwerijen", "nederland", "bv", "bottle"]
|
51
|
+
:tags: ["heineken", "lager", "beer", "netherlands", "heineken's", "heinekens", "brouwerijen", "nederland", "bv", "bottle"]
|
52
52
|
:price_in_cents: 1250
|
53
53
|
:regular_price_in_cents: 1350
|
54
54
|
:limited_time_offer_savings_in_cents: 100
|
@@ -336,7 +336,7 @@
|
|
336
336
|
:expectation:
|
337
337
|
:id: 56796
|
338
338
|
:name: Heineken Draught Keg
|
339
|
-
:tags: ["heineken", "draught", "keg", "beer", "lager", "netherlands", "heinekens", "brouwerijen", "nederland", "bv", "can"]
|
339
|
+
:tags: ["heineken", "draught", "keg", "beer", "lager", "netherlands", "heineken's", "heinekens", "brouwerijen", "nederland", "bv", "can"]
|
340
340
|
:price_in_cents: 2995
|
341
341
|
:regular_price_in_cents: 2995
|
342
342
|
:limited_time_offer_savings_in_cents: 0
|
data/spec/pages/store_pages.yml
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
:expectation:
|
8
8
|
:id: 444
|
9
9
|
:name: Kennedy & Sheppard
|
10
|
-
:tags: ["kennedy", "sheppard", "2356", "road", "agincourt", "mall", "toronto", "scarborough", "torontoscarborough", "m1t3h1"]
|
10
|
+
:tags: ["kennedy", "sheppard", "2356", "road", "agincourt", "mall", "toronto", "scarborough", "toronto-scarborough", "torontoscarborough", "m1t3h1"]
|
11
11
|
:address_line_1: 2356 Kennedy Road
|
12
12
|
:address_line_2: Agincourt Mall
|
13
13
|
:city: Toronto-Scarborough
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Carsten Nielsen
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-20 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|