activerecord-delegation-expected_behaviour 1.6.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/lib/activerecord-delegation-expected_behaviour.rb +5 -5
- metadata +5 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8a1fa359c026b61b527d1571aade1b25bd907ed5496a7ac27b58e1367665f49
|
4
|
+
data.tar.gz: f87e6b2869921de5836014a14a438f16e13a587520bf0aed16bad18a74af950b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dfbdf0fb5bd742949ed08ddccf7129eaff49aadbc8f48585d9dbe6a1ed8e14d822e939058a6d06f508a8b70e8f8ec44180c492e6e4c6d3141b31c9d4a4019a2
|
7
|
+
data.tar.gz: 64fa675b6041802ecd08e42516208a062d70816e7ab25bc0793136be7b44b3f129418f626cb82e29d962fa117083eca566af000498f78a6f450a0fcffa5c9a79
|
data/Rakefile
CHANGED
@@ -2,24 +2,24 @@ require 'active_record'
|
|
2
2
|
|
3
3
|
ActiveRecord::Delegation.module_eval do
|
4
4
|
REDELEGATED_METHODS = [:encode_with, :to_ary, :join, :[], :&, :|, :+, :-, :sample,
|
5
|
-
:reverse, :compact, :in_groups, :in_groups_of, :to_sentence, :
|
5
|
+
:reverse, :compact, :in_groups, :in_groups_of, :to_sentence, :to_fs,
|
6
6
|
:shuffle, :split, :index, :excluding]
|
7
7
|
|
8
8
|
REDELEGATED_METHODS.each do |method|
|
9
9
|
if method =~ /[^\]]=$/
|
10
10
|
define_method(method) { |arg| delegate_to_klass_or_records(method, arg) }
|
11
11
|
else
|
12
|
-
define_method(method) { |*args, &block| delegate_to_klass_or_records(method, *args, &block) }
|
12
|
+
define_method(method) { |*args, **kwargs, &block| delegate_to_klass_or_records(method, *args, **kwargs, &block) }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
protected
|
17
17
|
|
18
|
-
def delegate_to_klass_or_records(method, *args, &block)
|
18
|
+
def delegate_to_klass_or_records(method, *args, **kwargs, &block)
|
19
19
|
if @klass.respond_to?(method)
|
20
|
-
scoping { @klass.public_send(method, *args, &block) }
|
20
|
+
scoping { @klass.public_send(method, *args, **kwargs, &block) }
|
21
21
|
else
|
22
|
-
records.public_send(method, *args, &block)
|
22
|
+
records.public_send(method, *args, **kwargs, &block)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-delegation-expected_behaviour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,98 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.
|
19
|
+
version: '7.1'
|
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: 7.
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: sqlite3
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
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: byebug
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
26
|
+
version: '7.1'
|
111
27
|
description: Since Rails 5 you can no longer call some ActiveRecord class methods
|
112
28
|
named like their Enumerable counterparts. This gem reinstates the expected behaviour,
|
113
29
|
where you can always get the method from Enumerable by calling to_a on the relation.
|
@@ -139,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
55
|
- !ruby/object:Gem::Version
|
140
56
|
version: '0'
|
141
57
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
58
|
+
rubygems_version: 3.5.11
|
143
59
|
signing_key:
|
144
60
|
specification_version: 4
|
145
61
|
summary: Prefer some class methods over methods from Enumerable on relations
|