sewell 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sewell/version.rb +1 -1
- data/lib/sewell.rb +7 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cc476d2880d7559adf93942296f4d7f9d7876d7
|
4
|
+
data.tar.gz: 139437f77317f4aec2020db1362366d92cad36d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10e5e4421b9735d41dccbd510e129129cd1d997b76064f2b78c0fe6cde4db6c58fc4171ed6a3ce8cb50fefef8ed615d0bd60c0d0d8185236e997ce8cade8c9ea
|
7
|
+
data.tar.gz: 6176fce7f2dd4401f816d6049b76623c626e88a59594a6c6a9232136d5ce24e5b5f7fc44ce56b0da2a7815c510d2b5632b6ed2d2b374a72d8fdd85ec61be4c56
|
data/lib/sewell/version.rb
CHANGED
data/lib/sewell.rb
CHANGED
@@ -39,14 +39,20 @@ module Sewell
|
|
39
39
|
}.join " #{sep} "
|
40
40
|
end
|
41
41
|
|
42
|
+
def self.escape_groonga str
|
43
|
+
str.gsub(/(\"|\'|\(|\)|\\)/, "\\#{$1}")
|
44
|
+
end
|
45
|
+
|
42
46
|
def self.from_str str, tables
|
43
|
-
str.gsub!(/
|
47
|
+
str.gsub!(/ |^:/, ' ')
|
48
|
+
str = escape_groonga(str)
|
44
49
|
q = []
|
45
50
|
str.split(' ').map{|x|
|
46
51
|
q << x and next if x == 'OR' or x == 'AND'
|
47
52
|
if x.scan(/:/).count == 1
|
48
53
|
table = x.split(':').first
|
49
54
|
word = x.split(':').last
|
55
|
+
next unless word
|
50
56
|
if word.split('').first == '-'
|
51
57
|
q << "( #{table}:!#{sanitize word, /#{table}\:/} )"
|
52
58
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sewell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ssig33
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.0.
|
65
|
+
rubygems_version: 2.0.3
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Generator for Groonga's query
|