groonga-client 0.1.8 → 0.1.9

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: 0c389ff7c62caafda9b4442772fbb3c156b88ae5
4
- data.tar.gz: b58f127a618a43eb310451e03c8ea065f6cedf65
3
+ metadata.gz: c016fdb951f5e4022be440d654f89761dcab44ce
4
+ data.tar.gz: 41f64ca63d69c8540229ff4a40f1a5298b676ba5
5
5
  SHA512:
6
- metadata.gz: d75b1913b274ab25c157f7a7dce80cbacc48a6764863098e1967bf9adcff4db52ad1d479ee2c0381aa9eaabd5d6dff522e1689dd0f1baa2d6f92056243c4964e
7
- data.tar.gz: 4dcd03da83116e1484d46ae22a21b6b07d987502fe00c5b19708a56e8fc72f94c0e5393b9829f04c8f7476af27bdca9c598e7c76bcda24f1e658fa94ffe185ab
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
@@ -24,6 +24,7 @@ require "groonga/client/command"
24
24
  require "groonga/client/empty-request"
25
25
  require "groonga/client/protocol/gqtp"
26
26
  require "groonga/client/protocol/http"
27
+ require "groonga/client/script-syntax"
27
28
 
28
29
  module Groonga
29
30
  class Client
@@ -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
@@ -18,6 +18,6 @@
18
18
 
19
19
  module Groonga
20
20
  class Client
21
- VERSION = "0.1.8"
21
+ VERSION = "0.1.9"
22
22
  end
23
23
  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.8
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-08-08 00:00:00.000000000 Z
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: