ransacker_translator 0.0.4 → 0.1.0

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
- SHA1:
3
- metadata.gz: bed23fbda662050ad5336f1bd759b5bce18abf62
4
- data.tar.gz: d41bc7f0ad1ff7d7d8ba9133568aa2d0cf47a9c0
2
+ SHA256:
3
+ metadata.gz: ca09ecfe48e71a0668ffd2c3572252535149c05f24f8dfff32e5784cd9a4b08b
4
+ data.tar.gz: 17986f390a7752a53826b4b58ce2a06f28adc76fe0d1127874bc4a953bb48c48
5
5
  SHA512:
6
- metadata.gz: c7e12a13c5d4a3872af081d8f558efffada92839a4b8cc7d92e5b033455641d9363dfd7a876dc1155a830cebca1aa87ae20eae9770c2f9c4b1d98aea62bf1cf9
7
- data.tar.gz: b3fd20b6c3c252ed6a0e53e692c55984c75063ec9b7c533226c7d1be4b1f11b507c2c1175b4fac31e091cb3eb4ebdb6708c7829c4245b5c1c2e9d079fcb57d5c
6
+ metadata.gz: 575f351d5b9cc5083a2cb4672fd0a958c131cf23297759fe884c46f83809b3c6d4101b1852875ee404d9fe2224c670516872d6adfde7e279bde3ba3aff6e294d
7
+ data.tar.gz: 3941a934f674d3be5a077b37052ac182b49dec1f23b6cae52617123bc36d9743ed1e2173f4b48be894e93eb79d4b55c7891d769e0ccc96c7acad82ccaa34a8c3
data/Rakefile CHANGED
@@ -1,32 +1,6 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
6
3
 
7
- # require 'rdoc/task'
8
- #
9
- # RDoc::Task.new(:rdoc) do |rdoc|
10
- # rdoc.rdoc_dir = 'rdoc'
11
- # rdoc.title = 'RansackerTranslator'
12
- # rdoc.options << '--line-numbers'
13
- # rdoc.rdoc_files.include('README.rdoc')
14
- # rdoc.rdoc_files.include('lib/**/*.rb')
15
- # end
4
+ RSpec::Core::RakeTask.new(:spec)
16
5
 
17
-
18
-
19
-
20
- Bundler::GemHelper.install_tasks
21
-
22
- require 'rake/testtask'
23
-
24
- Rake::TestTask.new(:test) do |t|
25
- t.libs << 'lib'
26
- t.libs << 'test'
27
- t.pattern = 'test/**/*_test.rb'
28
- t.verbose = false
29
- end
30
-
31
-
32
- task default: :test
6
+ task :default => :spec
@@ -1 +1,4 @@
1
- require 'ransacker_translator/railtie' if defined? Rails
1
+ require 'ransacker_translator/version'
2
+ require 'ransacker_translator/railtie'
3
+ module RansackerTranslator
4
+ end
@@ -3,7 +3,7 @@ require 'nkf'
3
3
  module RansackerTranslator
4
4
  extend ActiveSupport::Concern
5
5
 
6
- module ClassMethods
6
+ class_methods do
7
7
  def ransacker_translate(*columns)
8
8
  columns.each do |column|
9
9
  ransacker :"#{column}_translate", formatter: proc {|v| NKF.nkf('-w -XZ0', v.mb_chars) } do |parent|
@@ -1,12 +1,11 @@
1
1
  require 'rails/railtie'
2
2
  require 'ransacker_translator/models/concerns/ransacker_translator'
3
3
  require 'ransacker_translator/controllers/concerns/format_ransack_parameters'
4
- require 'ransacker_translator/view_helpers'
5
4
 
6
5
  module RansackerTranslator
7
6
  class Railtie < ::Rails::Railtie
8
- initializer "ransacker_translator.view_helpers" do
9
- ActionView::Base.send :include, ViewHelpers
7
+ initializer "ransacker_translator" do
8
+ require 'ransacker_translator/view_helpers/action_view'
10
9
  end
11
10
  end
12
11
  end
@@ -1,3 +1,3 @@
1
1
  module RansackerTranslator
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,27 @@
1
+ module RansackerTranslator
2
+ module ViewHelpers
3
+ module ActionView
4
+ def ransack_params_array_to_s(key)
5
+ if params[:q].present? && params[:q][key].present?
6
+ params[:q][key].join(' ')
7
+ else
8
+ ''
9
+ end
10
+ end
11
+
12
+ def ransack_param_translate_normal_or_key(*columns)
13
+ "#{columns.join("_translate_or_")}_translate_cont_any"
14
+ end
15
+
16
+ def ransack_param_translate_normal_and_key(*columns)
17
+ "#{columns.join("_translate_and_")}_translate_cont_any"
18
+ end
19
+
20
+ def ransack_param_translate_ignore_key(*columns)
21
+ "#{columns.join("_translate_and_")}_translate_not_cont_all"
22
+ end
23
+
24
+ ::ActionView::Base.send :include, self
25
+ end
26
+ end
27
+ 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.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
- - Toyoaki Oko
7
+ - patorash
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2020-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 5.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0
26
+ version: 5.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ransack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,19 +39,89 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: sqlite3
42
+ name: pg
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
- type: :development
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: combustion
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: database_cleaner
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.7'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.7'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec_junit_formatter
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.4.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.4.1
55
125
  description: expand search by ransack
56
126
  email:
57
127
  - chariderpato@gmail.com
@@ -66,7 +136,7 @@ files:
66
136
  - lib/ransacker_translator/models/concerns/ransacker_translator.rb
67
137
  - lib/ransacker_translator/railtie.rb
68
138
  - lib/ransacker_translator/version.rb
69
- - lib/ransacker_translator/view_helpers.rb
139
+ - lib/ransacker_translator/view_helpers/action_view.rb
70
140
  homepage: https://github.com/patorash/ransacker_translator
71
141
  licenses:
72
142
  - MIT
@@ -86,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
156
  - !ruby/object:Gem::Version
87
157
  version: '0'
88
158
  requirements: []
89
- rubyforge_project:
90
- rubygems_version: 2.4.3
159
+ rubygems_version: 3.1.2
91
160
  signing_key:
92
161
  specification_version: 4
93
162
  summary: expand search by ransack
@@ -1,23 +0,0 @@
1
- module RansackerTranslator
2
- module ViewHelpers
3
- def ransack_params_array_to_s(key)
4
- if params[:q].present? && params[:q][key].present?
5
- params[:q][key].join(' ')
6
- else
7
- ''
8
- end
9
- end
10
-
11
- def ransack_param_translate_normal_or_key(*columns)
12
- "#{columns.join("_translate_or_")}_translate_cont_any"
13
- end
14
-
15
- def ransack_param_translate_normal_and_key(*columns)
16
- "#{columns.join("_translate_and_")}_translate_cont_any"
17
- end
18
-
19
- def ransack_param_translate_ignore_key(*columns)
20
- "#{columns.join("_translate_and_")}_translate_not_cont_all"
21
- end
22
- end
23
- end