Module: Roar::JSON::JSONAPI::Fragment

Defined in:
lib/roar/json/json_api.rb

Constant Summary collapse

Included =
->(document, included, options) do
  return unless included and included.any?
  return if options[:included] == false

  type_and_id_seen = Set.new

  included = included.select do |object|
    type_and_id_seen.add? [object[:type], object[:id]]
  end

  document[:included] = included
end
->(document, links, options) do
  document[:links] = links if links.any?
end