msfl_visitors 1.1.0.dev7 → 1.1.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 +4 -4
- data/lib/msfl_visitors/visitor.rb +1 -1
- data/msfl_visitors.gemspec +1 -1
- data/spec/msfl_visitors/visitors/chewy_term_filter_spec.rb +10 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59b0a99aa0756f6df016c0a83b95f26f1d0dea11
|
4
|
+
data.tar.gz: 15b2059bbd5815cd7ee512acbaa06c48804c2270
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa4bede1856b58d2fb1ad36d9856c935a71a83f988f06a28c9cb3653dd2bb76dac4d45448c7bd71b995c3d8910434f3b2dee04fae1907f83ec301ac62d9a9d93
|
7
|
+
data.tar.gz: bf4b42e0892f2a006c9c3b7a42e9dfe9475f6f83c614ed2e068fa4787c6d2e60074232324db56ddb181c471ec0c9c8d988de32dc8a3f8ef7eec355fc33fff4fe
|
@@ -84,7 +84,7 @@ module MSFLVisitors
|
|
84
84
|
when Nodes::Match
|
85
85
|
if node.right.is_a? Nodes::Set
|
86
86
|
regex = node.right.contents.map { |right_child| MSFLVisitors::Nodes::Regex.new(right_child.value.to_s).accept(visitor)[15..-6] }.join('|')
|
87
|
-
"#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} Regexp.new(
|
87
|
+
"#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} Regexp.new( '.*' + #{regex[4..-5]} + '.*' )"
|
88
88
|
else
|
89
89
|
"#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} #{MSFLVisitors::Nodes::Regex.new(node.right.value.to_s).accept(visitor)}"
|
90
90
|
end
|
data/msfl_visitors.gemspec
CHANGED
@@ -223,8 +223,8 @@ describe MSFLVisitors::Visitor do
|
|
223
223
|
|
224
224
|
context "when using the TermFilter visitor" do
|
225
225
|
|
226
|
-
it "results in: 'left =~ Regexp.new( \"
|
227
|
-
expect(result).to eq %(lhs =~ Regexp.new( "
|
226
|
+
it "results in: 'left =~ Regexp.new( '.*' + Regexp.parse( \"rhs\" ) + '.*' )'" do
|
227
|
+
expect(result).to eq %(lhs =~ Regexp.new( '.*' + Regexp.escape( "rhs" ) + '.*' ))
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
@@ -243,8 +243,8 @@ describe MSFLVisitors::Visitor do
|
|
243
243
|
|
244
244
|
context "when using the TermFilter visitor" do
|
245
245
|
|
246
|
-
it "results in: 'left =~ Regexp.new( \"
|
247
|
-
expect(result).to eq %(lhs =~ Regexp.new( "
|
246
|
+
it "results in: 'left =~ Regexp.new( '.*' + Regexp.escape( \"this (needs) to be* escaped\" ) + '.*' )'" do
|
247
|
+
expect(result).to eq %(lhs =~ Regexp.new( '.*' + Regexp.escape( "this (needs) to be* escaped" ) + '.*' ))
|
248
248
|
end
|
249
249
|
end
|
250
250
|
|
@@ -262,8 +262,8 @@ describe MSFLVisitors::Visitor do
|
|
262
262
|
|
263
263
|
context "when using the TermFilter visitor" do
|
264
264
|
|
265
|
-
it "results in: 'left =~ Regexp.new( \"
|
266
|
-
expect(result).to eq %(lhs =~ Regexp.new( "
|
265
|
+
it "results in: 'left =~ Regexp.new( '.*' + Regexp.escape( \"foo\" ) + '|' + Regexp.escape( \"bar\" ) + '|' + Regexp.escape( \"baz\" ) + '.*' )'" do
|
266
|
+
expect(result).to eq %(lhs =~ Regexp.new( '.*' + Regexp.escape( "foo" ) + '|' + Regexp.escape( "bar" ) + '|' + Regexp.escape( "baz" ) + '.*' ))
|
267
267
|
end
|
268
268
|
end
|
269
269
|
|
@@ -703,8 +703,8 @@ describe MSFLVisitors::Visitor do
|
|
703
703
|
|
704
704
|
let(:node) { MSFLVisitors::Nodes::Regex.new regex }
|
705
705
|
|
706
|
-
it "returns: 'Regexp.new( \"
|
707
|
-
expect(result).to eq %(Regexp.new( "
|
706
|
+
it "returns: 'Regexp.new( '.*' + Regexp.escape( \"content\" ) + '.*' )'" do
|
707
|
+
expect(result).to eq %(Regexp.new( '.*' + Regexp.escape( "#{regex}" ) + '.*' ))
|
708
708
|
end
|
709
709
|
|
710
710
|
context "when using the Aggregations visitor" do
|
@@ -722,8 +722,8 @@ describe MSFLVisitors::Visitor do
|
|
722
722
|
|
723
723
|
let(:node) { MSFLVisitors::Nodes::Regex.new regex }
|
724
724
|
|
725
|
-
it "returns: 'Regexp.new( \"
|
726
|
-
expect(result).to eq
|
725
|
+
it "returns: 'Regexp.new( '.*' + Regexp.escape( \"this / needs to % {be,escaped} *. ^[or] | \\else\" ) + '.*' )'" do
|
726
|
+
expect(result).to eq %(Regexp.new( '.*' + Regexp.escape( "this / needs to % {be,escaped} *. ^[or] | \\else" ) + '.*' ))
|
727
727
|
end
|
728
728
|
|
729
729
|
context "when using the Aggregations visitor" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msfl_visitors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Courtland Caldwell
|
@@ -172,9 +172,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
174
|
requirements:
|
175
|
-
- - "
|
175
|
+
- - ">="
|
176
176
|
- !ruby/object:Gem::Version
|
177
|
-
version:
|
177
|
+
version: '0'
|
178
178
|
requirements: []
|
179
179
|
rubyforge_project:
|
180
180
|
rubygems_version: 2.2.2
|