rdf-serializers 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ed97dbe57a341549fb3bf366bebc5b630fcded0
4
- data.tar.gz: ca39c6571dba789c392a76085e9548c4fc04bed0
3
+ metadata.gz: a4391cb7d489b6d9803ef2e089c5a18ddccdefc7
4
+ data.tar.gz: 8d6433403ea396f8c5d1b9c3d2ca3f8b31b2a518
5
5
  SHA512:
6
- metadata.gz: 259012b9e67240543b0423eabd7d7aac3f7281e4269d2513eceba2f0411e6ee501d5ffb756f3c461ece95e940cb7114894ed4bd9f7df8cae34f901b6b581c037
7
- data.tar.gz: deb4d015668dfac91cd37f42f20bd1610aa6b92d401b26db10c66405a4ede9730cce50f7102566a6149c5e50d30176f8807627ce78c78d491f52d7875ad8dead
6
+ metadata.gz: d677e2b57abb3e7e61e3e6e0093fde1bfb85bff31d656a9965e4a9a74cd11eaf3386a912397f3c60cdb06ebbcc20c21634034c1b2a340733301eb248a82f957d
7
+ data.tar.gz: ad515fd70be7102bda3cd44b4ac48f70a8ad02ffce3d1b66e25a2a036d2a8008a8ebcce11d38b04f5dfea51d42a7e91a7af1a7f8bd2a5323a5580d943cf226ee
@@ -70,21 +70,22 @@ module ActiveModelSerializers
70
70
  end
71
71
 
72
72
  def process_relationship(serializer, include_slice)
73
- if serializer.respond_to?(:each)
74
- serializer.each { |s| process_relationship(s, include_slice) }
75
- return
76
- end
73
+ return serializer.each { |s| process_relationship(s, include_slice) } if serializer.respond_to?(:each)
77
74
  return unless serializer&.object && process_resource(serializer, include_slice)
78
75
  process_relationships(serializer, include_slice)
79
76
  end
80
77
 
81
78
  def process_relationships(serializer, include_slice)
79
+ return unless serializer.respond_to?(:associations)
82
80
  serializer.associations(include_slice).each do |association|
83
81
  process_relationship(association.lazy_association.serializer, include_slice[association.key])
84
82
  end
85
83
  end
86
84
 
87
85
  def process_resource(serializer, include_slice = {})
86
+ if serializer.is_a?(ActiveModel::Serializer::CollectionSerializer)
87
+ return serializer.map { |child| process_resource(child, include_slice) }
88
+ end
88
89
  return unless serializer.respond_to?(:iri) || serializer.object.respond_to?(:iri)
89
90
  return false unless @resource_identifiers.add?(serializer.read_attribute_for_serialization(:iri))
90
91
  resource_object_for(serializer, include_slice)
@@ -92,10 +93,7 @@ module ActiveModelSerializers
92
93
  end
93
94
 
94
95
  def relationships_for(serializer, requested_associations, include_slice)
95
- include_directive = JSONAPI::IncludeDirective.new(
96
- requested_associations,
97
- allow_wildcard: true
98
- )
96
+ include_directive = JSONAPI::IncludeDirective.new(requested_associations, allow_wildcard: true)
99
97
  serializer.associations(include_directive, include_slice).each do |association|
100
98
  Relationship.new(serializer, instance_options, association).triples.each do |triple|
101
99
  @graph << triple
@@ -39,7 +39,11 @@ module ActiveModelSerializers
39
39
  parent_serializer.read_attribute_for_serialization(:iri)
40
40
  else
41
41
  serializer = association.lazy_association.serializer
42
- serializer.read_attribute_for_serialization(:iri) if serializer && association.object
42
+ if (virtual_value = association.virtual_value)
43
+ virtual_value[:id]
44
+ elsif serializer && association.object
45
+ serializer.read_attribute_for_serialization(:iri)
46
+ end
43
47
  end
44
48
  end
45
49
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RDFSerializers
4
4
  module Version
5
- VERSION = '0.0.2'
5
+ VERSION = '0.0.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Dingemans