msfl_visitors 1.1.0.dev5 → 1.1.0.dev6

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: 95d9fae385a3b9762ddba024ef96817d7d71739c
4
- data.tar.gz: 2a8d3d903e18961b9c0bd3e5cfb412a8bbd7bec9
3
+ metadata.gz: 32396eb4d354abc1354870d15fb22e2328aaa6a5
4
+ data.tar.gz: cf5865b6fcce2cb9e88cad25706d542439add95d
5
5
  SHA512:
6
- metadata.gz: ed7c6a16d6f6731ef09dce3c8efe5b87b1fc7368abb6326064636de15a2d9a5d11ef8994bcc7ed6776abcd599b17159ea5dd3f3df7d3905fa5844c4c6d9fa94a
7
- data.tar.gz: a3f06451b7983b88d5435088bd0a02afad2b07ce6a1e6a45c0c2cabba50d08b3dec99c739ef1f1ca583c2b33bc262f2355df63ac0499d6ef6450c7a4340fa8ba
6
+ metadata.gz: 5a6b76e2ea415343d350c8dce77a8422db02bf89370bc6df4787f498b723219589756d7018de2b8aa54755620772058d0d3cb86088d57fe07d973ba390987c7b
7
+ data.tar.gz: 901fbc5717a6ce8dfc72030a2864b0898b4e3ffbce0048f5c19f213a833b50acd8f8e5944c1a5d44e0ff81c8c82fbdc905d39124df5433f99dfe61abf963f9cd
@@ -73,7 +73,7 @@ module MSFLVisitors
73
73
  when Nodes::Field
74
74
  node.value.to_s
75
75
  when Nodes::Regex
76
- %(Regexp.new( "#{Regexp.escape(node.value)}" ))
76
+ %(Regexp.new( ".*#{Regexp.escape(node.value)}.*" ))
77
77
  when Nodes::Word
78
78
  "\"#{node.value}\""
79
79
  when Nodes::Date, Nodes::Time
@@ -83,8 +83,8 @@ module MSFLVisitors
83
83
 
84
84
  when Nodes::Match
85
85
  if node.right.is_a? Nodes::Set
86
- regex = node.right.contents.map { |right_child| MSFLVisitors::Nodes::Regex.new(right_child.value.to_s).accept(visitor)[13..-4] }.join('|')
87
- "#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} Regexp.new( \"#{regex}\" )"
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( \".*#{regex}.*\" )"
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'msfl_visitors'
3
- s.version = '1.1.0.dev5'
3
+ s.version = '1.1.0.dev6'
4
4
  s.date = '2015-05-28'
5
5
  s.summary = "Convert MSFL to other forms"
6
6
  s.description = "Visitor pattern approach to converting MSFL to other forms."
@@ -202,8 +202,8 @@ describe MSFLVisitors::Visitor do
202
202
 
203
203
  context "when using the TermFilter visitor" do
204
204
 
205
- it "results in: 'Regexp.new( \"foobar \")'" do
206
- expect(result).to eq %(Regexp.new( "foobar" ))
205
+ it "results in: 'Regexp.new( \".*foobar.*\")'" do
206
+ expect(result).to eq %(Regexp.new( ".*foobar.*" ))
207
207
  end
208
208
  end
209
209
 
@@ -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( \"rhs\" )'" do
227
- expect(result).to eq %(lhs =~ Regexp.new( "rhs" ))
226
+ it "results in: 'left =~ Regexp.new( \".*rhs.*\" )'" do
227
+ expect(result).to eq %(lhs =~ Regexp.new( ".*rhs.*" ))
228
228
  end
229
229
  end
230
230
 
@@ -249,8 +249,8 @@ describe MSFLVisitors::Visitor do
249
249
 
250
250
  context "when using the TermFilter visitor" do
251
251
 
252
- it "results in: 'left =~ Regexp.new( \"foo|bar|baz\" )'" do
253
- expect(result).to eq %(lhs =~ Regexp.new( "foo|bar|baz" ))
252
+ it "results in: 'left =~ Regexp.new( \".*foo|bar|baz.*\" )'" do
253
+ expect(result).to eq %(lhs =~ Regexp.new( ".*foo|bar|baz.*" ))
254
254
  end
255
255
  end
256
256
 
@@ -690,8 +690,8 @@ describe MSFLVisitors::Visitor do
690
690
 
691
691
  let(:node) { MSFLVisitors::Nodes::Regex.new regex }
692
692
 
693
- it "returns: 'Regexp.new( \"content\" )'" do
694
- expect(result).to eq %(Regexp.new( "#{regex}" ))
693
+ it "returns: 'Regexp.new( \".*content.*\" )'" do
694
+ expect(result).to eq %(Regexp.new( ".*#{regex}.*" ))
695
695
  end
696
696
 
697
697
  context "when using the Aggregations visitor" do
@@ -709,8 +709,8 @@ describe MSFLVisitors::Visitor do
709
709
 
710
710
  let(:node) { MSFLVisitors::Nodes::Regex.new regex }
711
711
 
712
- it "returns: 'Regexp.new( \"this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else\" )'" do
713
- expect(result).to eq "Regexp.new( \"this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else\" )"
712
+ it "returns: 'Regexp.new( \".*this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else.*\" )'" do
713
+ expect(result).to eq "Regexp.new( \".*this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else.*\" )"
714
714
  end
715
715
 
716
716
  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.dev5
4
+ version: 1.1.0.dev6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courtland Caldwell