ransacker_translator 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: bf0abe0ab6d1453c9171d900418123e03b3ca31088f306b02af01417f2f02624
4
- data.tar.gz: 1b4603c0145bf91fb15bd082cd5739fae763fca3caea7a0b4c3b3c005f65712b
3
+ metadata.gz: bcd66f080cb541c4f4deddde0b0168e43c632ac7529a4627316b307dce5dbde4
4
+ data.tar.gz: 19b4d1f63e23d63b0fb5932fef02c6f147958a036155d09ac9760f6448e70cdf
5
5
  SHA512:
6
- metadata.gz: 040a4a98c485dfb6c7f86ceee638177ae3be7996c87537f7c77d52d13b7a846ba57a63338e2bee0f59306f609e6d2f11b9c764709d9a264ac38ed2e20683d20b
7
- data.tar.gz: 2b0f4209b8a40d9b13c45d8714ec12e7d5f8bd5ac430af470eccfcf16928c9b3ed7ab523153ee6dfd992d77fce4b3a8e0816241d519450ab82aa0f904a333e20
6
+ metadata.gz: 43f16bcd68fbc37b149e2f7fb1b54784d9a174679fb6b4f5bddeba29395dfdf8a62ddf6873d15d042008a7ac7d93c16d3312202f1b02924319673cae4e7f79ef
7
+ data.tar.gz: 3a58b4a017b74539a195fd353a5986bf03e63d83f231b48b5afc4885a61709655e28bcfad3027c4da65976642cb128f97107efde29e7e6b457108e5263f7f859
@@ -5,6 +5,11 @@ module RansackerTranslator
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  class_methods do
8
+
9
+ # 指定したカラムでPostgreSQLのTRANSLATE関数を用いて変換をかけた上で検索を行う設定を行う
10
+ #
11
+ # @param [Array<Symbol>] *columns カラム名の配列
12
+ # @return [Void]
8
13
  def ransacker_translate(*columns)
9
14
  columns.each do |column|
10
15
  ransacker :"#{column}_translate", formatter: proc {|v| NKF.nkf('-w -XZ0', v.mb_chars) } do |parent|
@@ -1,3 +1,3 @@
1
1
  module RansackerTranslator
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,6 +1,11 @@
1
1
  module RansackerTranslator
2
2
  module ViewHelpers
3
3
  module ActionView
4
+
5
+ # paramsの指定したkeyの要素を半角スペースで繋いだ文字列にする
6
+ #
7
+ # @param [Symbol] key ransackで使っているキー
8
+ # @return [String] params[:q][key]を半角スペースでつなげた文字列
4
9
  def ransack_params_array_to_s(key)
5
10
  if params[:q].present? && params[:q][key].present?
6
11
  params[:q][key].join(' ')
@@ -8,15 +13,27 @@ module RansackerTranslator
8
13
  ''
9
14
  end
10
15
  end
11
-
16
+
17
+ # ransacker_translatorでOR検索に使うキーを返す
18
+ #
19
+ # @param [Array<String>] *columns カラム名の配列
20
+ # @return [String] ransacker_translatorでOR検索に使うキー
12
21
  def ransack_param_translate_normal_or_key(*columns)
13
22
  "#{columns.join("_translate_or_")}_translate_cont_any"
14
23
  end
15
-
24
+
25
+ # ransacker_translatorでAND検索に使うキーを返す
26
+ #
27
+ # @param [Array<String>] *columns カラム名の配列
28
+ # @return [String] ransacker_translatorでAND検索に使うキー
16
29
  def ransack_param_translate_normal_and_key(*columns)
17
30
  "#{columns.join("_translate_and_")}_translate_cont_any"
18
31
  end
19
-
32
+
33
+ # ransacker_translatorで除外検索に使うキーを返す
34
+ #
35
+ # @param [Array<String>] *columns カラム名の配列
36
+ # @return [String] ransacker_translatorで除外検索に使うキー
20
37
  def ransack_param_translate_ignore_key(*columns)
21
38
  "#{columns.join("_translate_and_")}_translate_not_cont_all"
22
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ransacker_translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - patorash
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-22 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 5.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 7.1.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 5.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 7.1.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: activesupport
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -31,6 +37,9 @@ dependencies:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
39
  version: 5.0.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: 7.1.0
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +47,9 @@ dependencies:
38
47
  - - ">="
39
48
  - !ruby/object:Gem::Version
40
49
  version: 5.0.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: 7.1.0
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: actionview
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +57,9 @@ dependencies:
45
57
  - - ">="
46
58
  - !ruby/object:Gem::Version
47
59
  version: 5.0.0
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: 7.1.0
48
63
  type: :runtime
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +67,9 @@ dependencies:
52
67
  - - ">="
53
68
  - !ruby/object:Gem::Version
54
69
  version: 5.0.0
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: 7.1.0
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: railties
57
75
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +77,9 @@ dependencies:
59
77
  - - ">="
60
78
  - !ruby/object:Gem::Version
61
79
  version: 5.0.0
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: 7.1.0
62
83
  type: :runtime
63
84
  prerelease: false
64
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,6 +87,9 @@ dependencies:
66
87
  - - ">="
67
88
  - !ruby/object:Gem::Version
68
89
  version: 5.0.0
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: 7.1.0
69
93
  - !ruby/object:Gem::Dependency
70
94
  name: ransack
71
95
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
208
  - !ruby/object:Gem::Version
185
209
  version: '0'
186
210
  requirements: []
187
- rubygems_version: 3.2.22
211
+ rubygems_version: 3.0.3.1
188
212
  signing_key:
189
213
  specification_version: 4
190
214
  summary: expand search by ransack