active_delegate 1.0.3 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_delegate/associations.rb +1 -1
- data/lib/active_delegate/attribute/object.rb +4 -0
- data/lib/active_delegate/attributes.rb +2 -2
- data/lib/active_delegate/version.rb +1 -1
- metadata +19 -14
- data/Gemfile.lock +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae8ce5fd34633f62a7727ceb324ea8487eef39b40f5b5e81955c43c42995f970
|
4
|
+
data.tar.gz: c4e475e366e17592a863823d8cb01a83cf91ab42a6c3eaeb1f08a0a35d750e13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e7b9cdf506185b33a567977a13fceb23d494dfd89676f37cc507ebb4a76a318d9369156990185ae479e37975b52d123310bcd84fab57cde0e1d473ad622af5b
|
7
|
+
data.tar.gz: f6c2fb8c0a7741e97d61c0c5d7e9afa9d9c24c2e2ca562dbf26a17f80a04f03399ec6fde702deee588c48d38e090cdda07d6bc7eb0097709fd764ad2b4344ffe
|
@@ -21,7 +21,7 @@ module ActiveDelegate
|
|
21
21
|
def call
|
22
22
|
delegatable_associations.each do |association|
|
23
23
|
methods = Association::Methods.new(association, association_class)
|
24
|
-
model.delegate(*methods.delegatable, delegation_options)
|
24
|
+
model.delegate(*methods.delegatable, **delegation_options)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -91,6 +91,10 @@ module ActiveDelegate
|
|
91
91
|
localized.any?
|
92
92
|
end
|
93
93
|
|
94
|
+
def accessible_attributes
|
95
|
+
@accessible_attributes ||= [unprefixed].map { |a| add_prefix(a) }
|
96
|
+
end
|
97
|
+
|
94
98
|
def delegatable_attributes
|
95
99
|
@delegatable_attributes ||= [unprefixed, *localized].map { |a| add_prefix(a) }
|
96
100
|
end
|
@@ -111,7 +111,7 @@ module ActiveDelegate
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def delegate_methods(methods)
|
114
|
-
model.delegate(*methods, delegation_options)
|
114
|
+
model.delegate(*methods, **delegation_options)
|
115
115
|
end
|
116
116
|
|
117
117
|
def define_model_method(method, *attributes)
|
@@ -130,7 +130,7 @@ module ActiveDelegate
|
|
130
130
|
def define_attribute_methods(attribute)
|
131
131
|
model.attribute(attribute.aliased, attribute.read_type) if attribute.define?
|
132
132
|
|
133
|
-
attribute.
|
133
|
+
attribute.accessible_attributes.each do |method_name|
|
134
134
|
redefine_attribute_accessors(method_name, attribute)
|
135
135
|
end
|
136
136
|
|
metadata
CHANGED
@@ -1,43 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_delegate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonian Guveli
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '7.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '5.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '7.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
39
|
+
version: '2.0'
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '2.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: minitest
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +64,14 @@ dependencies:
|
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
67
|
+
version: '13.0'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
74
|
+
version: '13.0'
|
69
75
|
description: Stores and retrieves delegatable data through attributes on an ActiveRecord
|
70
76
|
class, with support for translatable attributes.
|
71
77
|
email:
|
@@ -75,7 +81,6 @@ extensions: []
|
|
75
81
|
extra_rdoc_files: []
|
76
82
|
files:
|
77
83
|
- Gemfile
|
78
|
-
- Gemfile.lock
|
79
84
|
- LICENSE.txt
|
80
85
|
- README.md
|
81
86
|
- Rakefile
|
@@ -93,7 +98,7 @@ homepage: https://github.com/hardpixel/active-delegate
|
|
93
98
|
licenses:
|
94
99
|
- MIT
|
95
100
|
metadata: {}
|
96
|
-
post_install_message:
|
101
|
+
post_install_message:
|
97
102
|
rdoc_options: []
|
98
103
|
require_paths:
|
99
104
|
- lib
|
@@ -108,8 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
113
|
- !ruby/object:Gem::Version
|
109
114
|
version: '0'
|
110
115
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
112
|
-
signing_key:
|
116
|
+
rubygems_version: 3.1.2
|
117
|
+
signing_key:
|
113
118
|
specification_version: 4
|
114
119
|
summary: Delegate ActiveRecord model attributes and associations
|
115
120
|
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
active_delegate (1.0.1)
|
5
|
-
activerecord (~> 5.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activemodel (5.2.1)
|
11
|
-
activesupport (= 5.2.1)
|
12
|
-
activerecord (5.2.1)
|
13
|
-
activemodel (= 5.2.1)
|
14
|
-
activesupport (= 5.2.1)
|
15
|
-
arel (>= 9.0)
|
16
|
-
activesupport (5.2.1)
|
17
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>= 0.7, < 2)
|
19
|
-
minitest (~> 5.1)
|
20
|
-
tzinfo (~> 1.1)
|
21
|
-
arel (9.0.0)
|
22
|
-
concurrent-ruby (1.0.5)
|
23
|
-
i18n (1.1.0)
|
24
|
-
concurrent-ruby (~> 1.0)
|
25
|
-
minitest (5.10.3)
|
26
|
-
rake (10.5.0)
|
27
|
-
thread_safe (0.3.6)
|
28
|
-
tzinfo (1.2.5)
|
29
|
-
thread_safe (~> 0.1)
|
30
|
-
|
31
|
-
PLATFORMS
|
32
|
-
ruby
|
33
|
-
|
34
|
-
DEPENDENCIES
|
35
|
-
active_delegate!
|
36
|
-
bundler (~> 1.14)
|
37
|
-
minitest (~> 5.0)
|
38
|
-
rake (~> 10.0)
|
39
|
-
|
40
|
-
BUNDLED WITH
|
41
|
-
1.16.6
|