boogex 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/boogex.gemspec +5 -1
- data/lib/boogex/convertor.rb +1 -1
- data/lib/boogex/version.rb +1 -1
- data/test/convertor_test.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83f81d847ac61e973b5d4db503c9f03632308c9e
|
4
|
+
data.tar.gz: 09d2def1e45e8bd365b67f94f0157072c3ecfb31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 525ffc546863d4719e249a92b6939b44e3d716504dc53e776ddc11234090a94bb000638973233b234b7a597f97cbc4289e63a103d4e82c7bb7cf2782674800f8
|
7
|
+
data.tar.gz: b6ef7c7cba2d1948080e5dba10610f9b5da545b590253a67b2c7d3cf9fea5cb8e25b3f2cd0b33679a6ebade54ce06a230e69c859fcddbcc36c70500a10da7266
|
data/Gemfile.lock
CHANGED
data/boogex.gemspec
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "boogex/version"
|
4
|
+
|
1
5
|
Gem::Specification.new do |s|
|
6
|
+
s.version = Boogex::VERSION
|
2
7
|
s.name = 'boogex'
|
3
|
-
s.version = '0.1.0'
|
4
8
|
s.date = '2016-02-14'
|
5
9
|
s.homepage = 'https://github.com/lexerdev/boogex.gem'
|
6
10
|
s.license = 'MIT'
|
data/lib/boogex/convertor.rb
CHANGED
@@ -19,7 +19,7 @@ module Boogex
|
|
19
19
|
inside_brackets = "[^\(\)]*"
|
20
20
|
|
21
21
|
#This regex looks for anything in brackets OR anything with brackets in brackets OR anything with brackets in brackets in brackets
|
22
|
-
regex = /(\(#{inside_brackets}\))|(\(#{inside_brackets}\(#{inside_brackets}\)#{inside_brackets}\))|(\(#{inside_brackets}\(#{inside_brackets}\(#{inside_brackets}\)#{inside_brackets}\)#{inside_brackets}\))/
|
22
|
+
regex = /(\(#{inside_brackets}\))|(\(#{inside_brackets}\(#{inside_brackets}\)#{inside_brackets}\))|(\(#{inside_brackets}\(#{inside_brackets}\)[^\(]*\(#{inside_brackets}\)#{inside_brackets}\))|(\(#{inside_brackets}\(#{inside_brackets}\(#{inside_brackets}\)#{inside_brackets}\)#{inside_brackets}\))/
|
23
23
|
|
24
24
|
cuts = text.scan(regex).to_a.flatten.reject(&:nil?)
|
25
25
|
|
data/lib/boogex/version.rb
CHANGED
data/test/convertor_test.rb
CHANGED
@@ -35,4 +35,11 @@ describe Boogex do
|
|
35
35
|
result = Boogex.convert(string)
|
36
36
|
assert_equal expecting, result
|
37
37
|
end
|
38
|
+
|
39
|
+
it 'understands double embedded AND' do
|
40
|
+
string = 'Peeps OR ((dude OR roos) AND (what OR Footy))'
|
41
|
+
expecting = "Peeps|AND(['(?:dude|roos)','(?:what|Footy)'])"
|
42
|
+
result = Boogex.convert(string)
|
43
|
+
assert_equal expecting, result
|
44
|
+
end
|
38
45
|
end
|