msfl_visitors 1.2.1.dev0 → 1.2.1.dev1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e43425b31d0774b6b7bfef7b7a47dd8914195729
4
- data.tar.gz: b3fdf922ea429c522a77258ca40e5955d53373f3
3
+ metadata.gz: f37f5301f25a83e07f38aab1b3b82ee096d3ca1d
4
+ data.tar.gz: 609b068eff9ace33c8ef8f7c3b917f5392981143
5
5
  SHA512:
6
- metadata.gz: cc796e4b08f79201048cf37715f50cba54abc9026ebbb96669a5c8f4b3e8ef93505a65e2f5e1790494d3775521a65bfdcb30092ba1c7d1fffec329855684a8e7
7
- data.tar.gz: 142acb13b5679b278a9c2487ecace20e8917d3673a715b9ecbfa91ee1ea5ab71f131a49a2237851cdb50855e28b1ee8aa1468a831b548736eeb0700b02ffaa09
6
+ metadata.gz: d0d858070bcd4a52e6f9ab10513b60d19e9df46a92d880b42db0231a08cad0aef29c4015b8a752f5bc863785eb346a2c9d50654874ef87a086675bbf3053caf3
7
+ data.tar.gz: 5a86c87c0942efce43ca92c1822d02ff3a34bcd1776b49b04bc8f86d4b37a5deef56625ef29244ea4c279794b3ccb0d222429154c3ebf6099db134bd0583e22a
@@ -101,7 +101,7 @@ module MSFLVisitors
101
101
  when Nodes::Match
102
102
  if node.right.is_a? Nodes::Set
103
103
  escaped_str = node.right.contents.map { |right_child| MSFLVisitors::Nodes::Regex.new(right_child.value.to_s).accept(visitor).inspect[3..-4] }.join('|')
104
- "#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} " + escaped_regex_helper(escaped_str).inspect
104
+ "#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} " + %r[.*#{escaped_str}.*].inspect
105
105
  else
106
106
  "#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} " + MSFLVisitors::Nodes::Regex.new(node.right.value.to_s).accept(visitor).inspect
107
107
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'msfl_visitors'
3
- s.version = '1.2.1.dev0'
3
+ s.version = '1.2.1.dev1'
4
4
  s.date = '2015-06-19'
5
5
  s.summary = "Convert MSFL to other forms"
6
6
  s.description = "Visitor pattern approach to converting MSFL to other forms."
@@ -280,12 +280,12 @@ describe MSFLVisitors::Visitor do
280
280
 
281
281
  context "when the right hand side is a Value node that requires escaping" do
282
282
 
283
- let(:right) { MSFLVisitors::Nodes::Word.new 'this (needs) to be* escaped' }
283
+ let(:right) { MSFLVisitors::Nodes::Word.new 'this (ne&eds) to be* escaped' }
284
284
 
285
285
  context "when using the TermFilter visitor" do
286
286
 
287
- it "results in: 'left =~ /.*this\ \(needs\)\ to\ be\*\ escaped.*/'" do
288
- expect(result).to eq %(lhs =~ ) + /.*this\ \(needs\)\ to\ be\*\ escaped.*/.inspect
287
+ it "results in: 'left =~ /.*this\ \(ne\&eds\)\ to\ be\*\ escaped.*/'" do
288
+ expect(result).to eq %(lhs =~ ) + /.*this\ \(ne\&eds\)\ to\ be\*\ escaped.*/.inspect
289
289
  end
290
290
  end
291
291
 
@@ -306,6 +306,15 @@ describe MSFLVisitors::Visitor do
306
306
  it "results in: 'left =~ /.*foo|bar|baz.*/'" do
307
307
  expect(result).to eq %(lhs =~ ) + /.*foo|bar|baz.*/.inspect
308
308
  end
309
+
310
+ context "when one of the members of the Set requires escaping" do
311
+
312
+ let(:foo_node) { MSFLVisitors::Nodes::Word.new "please&*escape me" }
313
+
314
+ it "escapes special characters" do
315
+ expect(result).to eq %(lhs =~ ) + /.*please\&\*escape\ me|bar|baz.*/.inspect
316
+ end
317
+ end
309
318
  end
310
319
 
311
320
  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.2.1.dev0
4
+ version: 1.2.1.dev1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courtland Caldwell