gizzard 0.9.1 → 0.10.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
2
  SHA256:
3
- metadata.gz: cb2568fde715eb73945c6b19987ea08b3e2c72f34a6e4b5c5ab6dc8758d3f228
4
- data.tar.gz: 3522cc6db511d5038947be77b59f6cb91c001df133690455424297ac68bd2b6c
3
+ metadata.gz: ee9dce1d68e1340d6ece571a820cfe9e1d2747fa4f054fc76c61d94650afd1d3
4
+ data.tar.gz: 9edae9b1e9c06e39ff973226c7a831da823dd4f3494a6b042b5b6fd4268091f2
5
5
  SHA512:
6
- metadata.gz: d33ca160e6cf2499cab2eb47d122eb9200c1d255531b76ada7dfd91f79966f3cc0709fbd877bf69ad38c68435294d63d16012ecd341d6888f30b8226fa65cf28
7
- data.tar.gz: 55c1901b302755e81bc945337b9dec1f3d1ef92d3faeecd6f967fc679c9dbf30718ca10bd3772782ca03326b42e9823e84ecc576f5cab6d285426c91b5d27f56
6
+ metadata.gz: c5298a47808e83dc8cfc659e10cc0e5cc48e898e3e4e32288032adfe7949d84aa21cf457d0a0c9537883affd07d09680f59308ecb3a685cbb4035c9fcb50dd1a
7
+ data.tar.gz: 6e639cd57f45b9f321a70e6055ce493a1e9993defbdaceb88f02a05ddee9bb799a1f3ea4c5e6a143c9ef4b38671cef81aaac2a6129f223cfd218ce675cac6081
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Gizzard
2
2
 
3
- [![Build Status](https://github.com/taka0125/gizzard/workflows/Ruby/badge.svg?branch=main)](https://github.com/taka0125/gizzard/actions)
3
+ [![Build Status](https://github.com/taka0125/gizzard/actions/workflows/main.yml/badge.svg)](https://github.com/taka0125/gizzard/actions/workflows/main.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/gizzard.svg)](https://badge.fury.io/rb/gizzard)
4
5
 
5
6
  Often use snippet for ActiveRecord.
6
7
 
data/lib/gizzard/base.rb CHANGED
@@ -7,11 +7,7 @@ module Gizzard
7
7
  records = Array(records)
8
8
  return if records.empty?
9
9
 
10
- if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new(7)
11
- ActiveRecord::Associations::Preloader.new(records: records, associations: associations, scope: scope).call
12
- else
13
- ActiveRecord::Associations::Preloader.new.preload(records, associations, scope)
14
- end
10
+ ActiveRecord::Associations::Preloader.new(records: records, associations: associations, scope: scope).call
15
11
  end
16
12
 
17
13
  def delete_all_by_id(batch_size: 1000)
data/lib/gizzard/mysql.rb CHANGED
@@ -7,7 +7,9 @@ module Gizzard
7
7
 
8
8
  scope :filtered_by, -> (column, value) do
9
9
  v = value.respond_to?(:strip) ? value.strip : value
10
- v.present? ? where(column => v) : all
10
+ return where(column => v) if v.present?
11
+
12
+ all
11
13
  end
12
14
 
13
15
  scope :forward_matching_by, -> (column, value) { where("`#{table_name}`.`#{column}` LIKE ?", "#{sanitize_sql_like(value)}%") }
@@ -17,7 +19,9 @@ module Gizzard
17
19
 
18
20
  class_methods do
19
21
  def order_by_field(column, values)
20
- values.present? ? order(Arel.sql("field(`#{table_name}`.`#{column}`, #{values.join(',')})")) : all
22
+ return in_order_of(column, values) unless values.empty?
23
+
24
+ all
21
25
  end
22
26
 
23
27
  def order_by_id_field(ids)
@@ -1,3 +1,3 @@
1
1
  module Gizzard
2
- VERSION = "0.9.1"
2
+ VERSION = "0.10.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gizzard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiro Ooishi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-17 00:00:00.000000000 Z
11
+ date: 2024-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '7.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: '5.2'
26
+ version: '7.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5.2'
33
+ version: '7.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '5.2'
40
+ version: '7.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ridgepole
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -207,8 +207,11 @@ files:
207
207
  - lib/gizzard/version.rb
208
208
  - sig/gizzard.rbs
209
209
  homepage: https://github.com/taka0125/gizzard
210
- licenses: []
211
- metadata: {}
210
+ licenses:
211
+ - MIT
212
+ metadata:
213
+ homepage_uri: https://github.com/taka0125/gizzard
214
+ source_code_uri: https://github.com/taka0125/gizzard
212
215
  post_install_message:
213
216
  rdoc_options: []
214
217
  require_paths:
@@ -217,14 +220,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
220
  requirements:
218
221
  - - ">="
219
222
  - !ruby/object:Gem::Version
220
- version: '0'
223
+ version: 3.1.0
221
224
  required_rubygems_version: !ruby/object:Gem::Requirement
222
225
  requirements:
223
226
  - - ">="
224
227
  - !ruby/object:Gem::Version
225
228
  version: '0'
226
229
  requirements: []
227
- rubygems_version: 3.4.10
230
+ rubygems_version: 3.4.19
228
231
  signing_key:
229
232
  specification_version: 4
230
233
  summary: Often use snippet for ActiveRecord.