msfl_visitors 1.1.0.dev4 → 1.1.0.dev5

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: e7618102d9f99a0c0355ca268490a8f333726946
4
- data.tar.gz: d53c6a5cafbb278a65a5be4d18342a9b90b492c5
3
+ metadata.gz: 95d9fae385a3b9762ddba024ef96817d7d71739c
4
+ data.tar.gz: 2a8d3d903e18961b9c0bd3e5cfb412a8bbd7bec9
5
5
  SHA512:
6
- metadata.gz: 69d662a60f191114662fa52b9cac362891d3e51f75405610fec3ebeb0be29a8bd47e8c8b4cdb34a18fa699203bcd115624479078f00e4102d3d639bf4e37b994
7
- data.tar.gz: 8196994112628bf366eb554ffd291c95ce47a4b1bba99ec885eea7457a7717dfdc5a612a347b7a818fefa6e80380d7b746ea1833edd52a1613ef6ed29ec51c2f
6
+ metadata.gz: ed7c6a16d6f6731ef09dce3c8efe5b87b1fc7368abb6326064636de15a2d9a5d11ef8994bcc7ed6776abcd599b17159ea5dd3f3df7d3905fa5844c4c6d9fa94a
7
+ data.tar.gz: a3f06451b7983b88d5435088bd0a02afad2b07ce6a1e6a45c0c2cabba50d08b3dec99c739ef1f1ca583c2b33bc262f2355df63ac0499d6ef6450c7a4340fa8ba
@@ -73,7 +73,7 @@ module MSFLVisitors
73
73
  when Nodes::Field
74
74
  node.value.to_s
75
75
  when Nodes::Regex
76
- "/#{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)[1..-2] }.join('|') + '/'
87
- "#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} #{regex}"
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}\" )"
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.dev4'
3
+ s.version = '1.1.0.dev5'
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: '/foobar/'" do
206
- expect(result).to eq "/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 =~ /right/'" do
227
- expect(result).to eq "lhs =~ /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 =~ /foo|bar|baz/'" do
253
- expect(result).to eq "lhs =~ /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: \"/content/\"" do
694
- expect(result).to eq "/#{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: '/this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else/'" do
713
- expect(result).to eq "/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.dev4
4
+ version: 1.1.0.dev5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courtland Caldwell