groonga-client 0.1.8 → 0.1.9
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 +4 -4
- data/doc/text/news.md +8 -0
- data/lib/groonga/client.rb +1 -0
- data/lib/groonga/client/script-syntax.rb +30 -0
- data/lib/groonga/client/version.rb +1 -1
- data/test/test-script-syntax.rb +38 -0
- metadata +14 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c016fdb951f5e4022be440d654f89761dcab44ce
|
4
|
+
data.tar.gz: 41f64ca63d69c8540229ff4a40f1a5298b676ba5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1bfa34ff628a40c8645689ab9a2536b0979d8faef135898f154d1ec454f870fd17f6e5688d6395b26645a8005b9a9c177f4dd2e554ac554608fd0a68a23c558
|
7
|
+
data.tar.gz: 996cccebedcefbce77dbf9546b470424afaa8215558961be0cc898cc732d723e60874dad6bcf95b15759b9f87afa6b42f90c94e943649aa43da238f719e42dac
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# NEWS
|
2
2
|
|
3
|
+
## 0.1.9 - 2015-09-04
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* {Groonga::Client::ScriptSyntax#format_string}: Added a method that
|
8
|
+
formats the given Ruby `String` as string
|
9
|
+
[in Groonga's script syntax](http://groonga.org/docs/reference/grn_expr/script_syntax.html#string).
|
10
|
+
|
3
11
|
## 0.1.8 - 2015-08-08
|
4
12
|
|
5
13
|
### Improvements
|
data/lib/groonga/client.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
module Groonga
|
18
|
+
class Client
|
19
|
+
module ScriptSyntax
|
20
|
+
class << self
|
21
|
+
def format_string(string)
|
22
|
+
escaped_string = string.gsub(/["\\]/) do |matched|
|
23
|
+
"\\#{matched}"
|
24
|
+
end
|
25
|
+
"\"#{escaped_string}\""
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class TestScriptSyntax < Test::Unit::TestCase
|
18
|
+
sub_test_case ".format_string" do
|
19
|
+
def format(string)
|
20
|
+
Groonga::Client::ScriptSyntax.format_string(string)
|
21
|
+
end
|
22
|
+
|
23
|
+
test "no special characters" do
|
24
|
+
assert_equal("\"Hello\"",
|
25
|
+
format("Hello"))
|
26
|
+
end
|
27
|
+
|
28
|
+
test "double quote" do
|
29
|
+
assert_equal("\"Say \\\"Hello\\\"!\"",
|
30
|
+
format("Say \"Hello\"!"))
|
31
|
+
end
|
32
|
+
|
33
|
+
test "back slash" do
|
34
|
+
assert_equal("\"Go c:\\\\Windows!\"",
|
35
|
+
format("Go c:\\Windows!"))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groonga-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Haruka Yoshihara
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-09-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: gqtp
|
@@ -206,6 +206,7 @@ files:
|
|
206
206
|
- lib/groonga/client/response/status.rb
|
207
207
|
- lib/groonga/client/response/table_create.rb
|
208
208
|
- lib/groonga/client/response/table_list.rb
|
209
|
+
- lib/groonga/client/script-syntax.rb
|
209
210
|
- lib/groonga/client/version.rb
|
210
211
|
- test/protocol/test-gqtp.rb
|
211
212
|
- test/protocol/test-http.rb
|
@@ -221,6 +222,7 @@ files:
|
|
221
222
|
- test/run-test.rb
|
222
223
|
- test/test-client.rb
|
223
224
|
- test/test-command.rb
|
225
|
+
- test/test-script-syntax.rb
|
224
226
|
homepage: https://github.com/ranguba/groonga-client
|
225
227
|
licenses:
|
226
228
|
- LGPLv2.1 or later
|
@@ -247,18 +249,19 @@ specification_version: 4
|
|
247
249
|
summary: Groonga-client is a client for groonga (http://groonga.org/) implemented
|
248
250
|
with pure ruby.
|
249
251
|
test_files:
|
252
|
+
- test/test-script-syntax.rb
|
253
|
+
- test/protocol/test-http.rb
|
254
|
+
- test/protocol/test-gqtp.rb
|
255
|
+
- test/response/test-error.rb
|
256
|
+
- test/response/test-select.rb
|
257
|
+
- test/response/test-table-list.rb
|
258
|
+
- test/response/test-column-list.rb
|
259
|
+
- test/response/helper.rb
|
260
|
+
- test/response/test-base.rb
|
261
|
+
- test/response/test-status.rb
|
250
262
|
- test/results/test-table-list.rb
|
251
263
|
- test/results/test-column-list.rb
|
252
264
|
- test/test-command.rb
|
253
265
|
- test/run-test.rb
|
254
266
|
- test/test-client.rb
|
255
|
-
- test/protocol/test-gqtp.rb
|
256
|
-
- test/protocol/test-http.rb
|
257
|
-
- test/response/test-table-list.rb
|
258
|
-
- test/response/test-error.rb
|
259
|
-
- test/response/test-base.rb
|
260
|
-
- test/response/test-status.rb
|
261
|
-
- test/response/test-select.rb
|
262
|
-
- test/response/helper.rb
|
263
|
-
- test/response/test-column-list.rb
|
264
267
|
has_rdoc:
|