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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 527b56ff39a1ef27ee5c54953f2f018825519e22
4
- data.tar.gz: 2d0b50e7a59b37091a252e38023238dba36aaac9
3
+ metadata.gz: 59b0a99aa0756f6df016c0a83b95f26f1d0dea11
4
+ data.tar.gz: 15b2059bbd5815cd7ee512acbaa06c48804c2270
5
5
  SHA512:
6
- metadata.gz: 08254e255043304901bd24d758f847f737bf2b3aff4c9b278bf7cfccad41eb213f0d932b0b4ad9a7806baaf083bb03d1d634b8a47550f27432beb87cbc4042a2
7
- data.tar.gz: 7f1e8de48af5eeff14d409a7ffc904e1eb117e0aa1cc4910620740bcd3fbbf74fca0b601ab69493a4a8070015667ea5b3921792855723d41bcbf2b8c1e794196
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( \".*#{regex}.*\" )"
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'msfl_visitors'
3
- s.version = '1.1.0.dev7'
3
+ s.version = '1.1.0'
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."
@@ -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( '.*' + 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( \".*this\\ \\(needs\\)\\ to\\ be\\*\\ escaped.*\" )'" do
247
- expect(result).to eq %(lhs =~ Regexp.new( ".*this\\ \\(needs\\)\\ to\\ be\\*\\ escaped.*" ))
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( \".*foo|bar|baz.*\" )'" do
266
- expect(result).to eq %(lhs =~ Regexp.new( ".*foo|bar|baz.*" ))
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( \".*content.*\" )'" do
707
- expect(result).to eq %(Regexp.new( ".*#{regex}.*" ))
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( \".*this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else.*\" )'" do
726
- expect(result).to eq "Regexp.new( \".*this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else.*\" )"
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.dev7
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: 1.3.1
177
+ version: '0'
178
178
  requirements: []
179
179
  rubyforge_project:
180
180
  rubygems_version: 2.2.2