ama-entity-mapper 0.1.0.beta.3 → 0.1.0.beta.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14ab115f3990a90412afca4a11ff3dc433a70344
|
4
|
+
data.tar.gz: 412302f9f727b9b3a2893e36b89b5a775c0c8ff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2cae0bdb19f04ffd27aad407837010b2bde791fea92dca8d16bce31c7810ec1d4f108ff255cd74a1dc32b7a50b41751675d24d3be99dfa004aa6d9fbfe9ce7b
|
7
|
+
data.tar.gz: 7091f1f407d882f7cac534ead0d4dd3498324952181e70575ef58eaf897355cf53b05c56333e9909805a32c4897cb46750c0b38d1c0de674f3f3274614a7528e
|
@@ -19,7 +19,7 @@ module AMA
|
|
19
19
|
# @param [Object] _data
|
20
20
|
# @param [AMA::Entity::Mapper::Context] context
|
21
21
|
def create(type, _data, context)
|
22
|
-
create_internal(type)
|
22
|
+
create_internal(type, context)
|
23
23
|
rescue StandardError => e
|
24
24
|
message = "Failed to instantiate #{type} directly from class"
|
25
25
|
if e.is_a?(ArgumentError)
|
@@ -31,13 +31,15 @@ module AMA
|
|
31
31
|
private
|
32
32
|
|
33
33
|
# @param [AMA::Entity::Mapper::Type] type
|
34
|
-
|
34
|
+
# @param [AMA::Entity::Mapper::Context] context
|
35
|
+
def create_internal(type, context)
|
35
36
|
entity = type.type.new
|
36
37
|
type.attributes.values.each do |attribute|
|
37
38
|
next if attribute.default.nil? || attribute.virtual
|
38
39
|
segment = Path::Segment.attribute(attribute.name)
|
40
|
+
ctx = context.advance(segment)
|
39
41
|
value = attribute.default
|
40
|
-
type.injector.inject(entity, type, attribute, value,
|
42
|
+
type.injector.inject(entity, type, attribute, value, ctx)
|
41
43
|
end
|
42
44
|
entity
|
43
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ama-entity-mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.beta.
|
4
|
+
version: 0.1.0.beta.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AMA Team
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: 1.3.1
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.6.
|
190
|
+
rubygems_version: 2.6.12
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: Converts and instantiates classes from native data structures
|