sewell 1.0.4 → 1.0.5

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: 440265a1625ef9efb9062be096819e79b8d60a54
4
- data.tar.gz: e69abbe115631b8b748ef8bd92b75d01f9b13195
3
+ metadata.gz: 358b5a20e3f8dc39abca06e1e662453f7d4528ac
4
+ data.tar.gz: 191fb1bf2b737c1b9e8bd5df1be4ab43b1ac4c24
5
5
  SHA512:
6
- metadata.gz: 4d40efdf12b6413fda0a4233a9a9b13cf4dfc1309c9290865516deb9e24ede92910c27de631665990989e2053ad74ff44ac9ec173bb6b15a4e840ba756eb6ee1
7
- data.tar.gz: 52a4c4d7802f50b236f671a3508ed6e8fb66565d244804e7bdc03f410d24db8fb3b0fa6f6c6d39e17a764ff92170e2a164f4ff8b970c1f47983fa2b373903b77
6
+ metadata.gz: c33e4631231346e36a459c5a9acb861bd5233ca268b1a9a5afb95a73b3e9201fe6284d087575827264ecf08a89b768d9874def9698a943c01bb833922be7e303
7
+ data.tar.gz: a3c26999e6bf16d1df44c46b6aecc39b7796b9120522917c0f563a007cc4965011bf5786a6fba71a6877f6682492345ada7e2ade0591f83a0182023e18da6a46
@@ -1,3 +1,3 @@
1
1
  module Sewell
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
data/lib/sewell.rb CHANGED
@@ -51,7 +51,26 @@ module Sewell
51
51
  str.gsub!(/ |^:/, ' ')
52
52
  str = escape_groonga(str)
53
53
  q = []
54
- str.split(' ').map{|x|
54
+ ary = str.split(' ')
55
+ ary.each_with_index{|x,i|
56
+ next if x.nil?
57
+ if x =~ /^\"/
58
+ original_x = x.dup
59
+ i = i + 1
60
+ is = []
61
+ while n = ary[i]
62
+ x = x + " #{n}"
63
+ is << i
64
+ break if ary[i] =~ /\"$/
65
+ i = i + 1
66
+ end
67
+ unless x =~ /\"$/
68
+ x = original_x.gsub('"', '')
69
+ else
70
+ is.each{|index| ary[index] = nil }
71
+ end
72
+ end
73
+
55
74
  q << x and next if x == 'OR' or x == 'AND'
56
75
  if x.scan(/:/).count == 1
57
76
  table = x.split(':').first
@@ -19,4 +19,9 @@ describe Sewell do
19
19
  it 'can generate with "-"' do
20
20
  Sewell.generate('ビジュメニア - Single', ['buta']).should == "( buta:@ビジュメニア ) + ( buta:@Single )"
21
21
  end
22
+
23
+ it 'can use "" with OR' do
24
+ Sewell.generate('"Rainy veil" OR あなたの愛した世界', ['buta']).should == "( buta:@\"Rainy veil\" ) OR ( buta:@あなたの愛した世界 )"
25
+ Sewell.generate('あなたの愛した世界 OR "Rainy veil"', ['buta']).should == "( buta:@あなたの愛した世界 ) OR ( buta:@\"Rainy veil\" )"
26
+ end
22
27
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sewell
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ssig33
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-20 00:00:00.000000000 Z
11
+ date: 2015-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Generator for Groonga's query
@@ -45,8 +45,8 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
49
- - .rspec
48
+ - ".gitignore"
49
+ - ".rspec"
50
50
  - Gemfile
51
51
  - LICENSE
52
52
  - README.md
@@ -66,17 +66,17 @@ require_paths:
66
66
  - lib
67
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.0.3
79
+ rubygems_version: 2.4.5
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Generator for Groonga's query