Sha256: fc6bbb64273b875116d518aed662f1af41c8f464ffcf91daf70b5754c9ef13f0

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

module Jei
  module Builders
    module ResourceNodeBuilder
      include Nodes

      # @param [Serializer] serializer
      # @param [Array<Symbol>] fieldset
      # @return [ResourceNode]
      def self.build(serializer, fieldset = nil)
        node = ResourceNode.new

        node.children << ResourceIdentifierNode.new(serializer)

        attributes = serializer.attributes(fieldset).values

        if attributes.any?
          node.children << AttributesNodeBuilder.build(attributes, serializer)
        end

        relationships = serializer.relationships(fieldset).values

        if relationships.any?
          node.children << RelationshipsNodeBuilder.build(relationships, serializer)
        end

        links = serializer.links

        if links
          node.children << LinksNodeBuilder.build(links)
        end

        node
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jei-0.2.0 lib/jei/builders/resource_node_builder.rb