aduki 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/aduki.rb +6 -1
- data/lib/aduki/version.rb +1 -1
- data/spec/initialize_with_object_spec.rb +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d05eacb8c1fcf4375cf8ccdd1214f2327f36956c
|
4
|
+
data.tar.gz: 234193b89c439e6300a85c6b50f23f1c8d57a0c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61ebf8352dbf342a2fcd4b1032d9508813ea502016788ae931040e9fd36b34565df12db112d729ea04265c30979c8dd12a9ccbfa0c898dce6e1a8459bd9c5cfa
|
7
|
+
data.tar.gz: 74692ea9100157125497e39a85c5e00b093c2f927d5139a11aa05b9cb21ae5521c998577038e560587342a70dc3efff478c96c7e43ab2508b05d8612a9298c2d
|
data/lib/aduki.rb
CHANGED
@@ -40,7 +40,9 @@ module Aduki
|
|
40
40
|
return value.map { |v| to_value klass, setter, v} if value.is_a? Array
|
41
41
|
|
42
42
|
type = klass.aduki_type_for_attribute_name setter
|
43
|
-
if type.
|
43
|
+
if type && (value.class <= type)
|
44
|
+
value
|
45
|
+
elsif type.is_a? Hash
|
44
46
|
to_typed_hash type.values.first, value
|
45
47
|
elsif type == Date
|
46
48
|
case value
|
@@ -181,8 +183,11 @@ module Aduki
|
|
181
183
|
def initialize attrs={ }
|
182
184
|
self.class.get_aduki_initializers.each { |initializer| send initializer }
|
183
185
|
Aduki.apply_attributes self, attrs
|
186
|
+
aduki_after_initialize
|
184
187
|
end
|
185
188
|
|
189
|
+
def aduki_after_initialize ; end
|
190
|
+
|
186
191
|
def self.included(base)
|
187
192
|
base.extend Aduki::ClassMethods
|
188
193
|
end
|
data/lib/aduki/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aduki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Conan Dalton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- spec/attr_finder_spec.rb
|
61
61
|
- spec/custom_builder_spec.rb
|
62
62
|
- spec/finder_spec.rb
|
63
|
+
- spec/initialize_with_object_spec.rb
|
63
64
|
- spec/initializer_spec.rb
|
64
65
|
- spec/merge_attributes_spec.rb
|
65
66
|
- spec/model.rb
|
@@ -97,6 +98,7 @@ test_files:
|
|
97
98
|
- spec/attr_finder_spec.rb
|
98
99
|
- spec/custom_builder_spec.rb
|
99
100
|
- spec/finder_spec.rb
|
101
|
+
- spec/initialize_with_object_spec.rb
|
100
102
|
- spec/initializer_spec.rb
|
101
103
|
- spec/merge_attributes_spec.rb
|
102
104
|
- spec/model.rb
|