active_form_objects 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dsl/attributes.rb +6 -0
- data/lib/handlers/resource.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7309d6b773941debdd36cea75f51b5b1283b0d6ce68a405c871a330ff66fae94
|
4
|
+
data.tar.gz: f7b7ba2844b0275e699b9d61b30aa735c018e69283a9d3554469711b0e1e1f6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66e6e119ad7709506ddbd1b0dfb7829a3b5ef9569c1314f8d596767b46a3a580f3d1491ec93a739c45b5cab596754aa284e124925e6300c7047afc6d9b3d1de9
|
7
|
+
data.tar.gz: '0294103c0731a28629de35e9a7b727e17b7e84ef6ec5fa6577b4ba34563209d5d632c519a769c7b02186208a0bce5d846912a8e20aa4cde6bd7d608820606353'
|
data/lib/dsl/attributes.rb
CHANGED
data/lib/handlers/resource.rb
CHANGED
@@ -6,7 +6,15 @@ module Handlers
|
|
6
6
|
class_resource = upper(:@@resource)
|
7
7
|
@resource ||= class_resource.try(:call, @params).try(:new)
|
8
8
|
|
9
|
+
attempt_resource_autoset
|
10
|
+
|
9
11
|
@klass.instance_variable_set(:@resource, @resource)
|
10
12
|
end
|
13
|
+
|
14
|
+
def attempt_resource_autoset
|
15
|
+
class_name = @klass.class.name.split('Form')[0].constantize if @klass.class.name.include?('Form')
|
16
|
+
@resource ||= class_name.instance_of?(Class) ? class_name.new : nil
|
17
|
+
rescue
|
18
|
+
end
|
11
19
|
end
|
12
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_form_objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michaël Villeneuve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|