glue_gun_dsl 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/glue_gun/dsl.rb +12 -3
- data/lib/glue_gun/version.rb +1 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d171bf5b89935cfbb7f73b6add32d1a2a98a6ec84d657eff4500d8de1aaa57d2
|
4
|
+
data.tar.gz: e9290e534a44f9ca5a8b64340e47c9ff7a186c45e39b500a363c6186451fae99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 589a3cc8f145665ef33cc2ba98f4b503fec3eab9a187bd03a7c6582641218a6947711b98971f76e98c67f2f9df350a9426228a77ee69d3dcd96062316734a7c3
|
7
|
+
data.tar.gz: 766fcd59efebfd026696da619e1c399f5c53f5878bea1f4c7ef4580b0c8141b403c6787a6e5be0dff7a78f203ee9e9444c0652523ede6e9542b25e0710da8da1
|
data/lib/glue_gun/dsl.rb
CHANGED
@@ -64,8 +64,13 @@ module GlueGun
|
|
64
64
|
end
|
65
65
|
|
66
66
|
module ClassMethods
|
67
|
+
DEFAULT_TYPE = if ActiveModel.version >= Gem::Version.new("7")
|
68
|
+
nil
|
69
|
+
elsif ActiveModel.version >= Gem::Version.new("5")
|
70
|
+
ActiveModel::Type::Value.new
|
71
|
+
end
|
67
72
|
# Override the attribute method to define custom setters
|
68
|
-
def attribute(name, type =
|
73
|
+
def attribute(name, type = DEFAULT_TYPE, **options)
|
69
74
|
super(name, type, **options)
|
70
75
|
attribute_definitions[name.to_sym] = { type: type, options: options }
|
71
76
|
|
@@ -263,8 +268,12 @@ module GlueGun
|
|
263
268
|
(attr_config.source == attr_name.to_sym) || (attr_config.name == attr_name.to_sym)
|
264
269
|
end
|
265
270
|
|
266
|
-
bound_attrs.each do |dep_attr_name,
|
267
|
-
|
271
|
+
bound_attrs.each do |dep_attr_name, config_attr|
|
272
|
+
block = config_attr.block.present? ? config_attr.block : proc { |att| att }
|
273
|
+
if dependency_instance.respond_to?("#{dep_attr_name}=")
|
274
|
+
dependency_instance.send("#{dep_attr_name}=",
|
275
|
+
block.call(value))
|
276
|
+
end
|
268
277
|
end
|
269
278
|
end
|
270
279
|
end
|
data/lib/glue_gun/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glue_gun_dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Shollenberger
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '8'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '6'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '8'
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '6'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '8'
|
@@ -46,10 +46,24 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '6'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '8'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: appraisal
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
68
|
name: guard
|
55
69
|
requirement: !ruby/object:Gem::Requirement
|