Sha256: 2dd0efa7c64f6b724a3d05725c3405a5f661b7cee54fd7beaad9a06b3a49ed82

Contents?: true

Size: 475 Bytes

Versions: 4

Compression:

Stored size: 475 Bytes

Contents

# frozen_string_literal: true
module Agave
  module Local
    module FieldType
      class Links < Array
        def self.parse(ids, repo)
          items = if ids
                    ids.map { |id| repo.find(id) }
                  else
                    []
                  end
          new(items)
        end

        def to_hash(max_depth = 3, current_depth = 0)
          map { |item| item.to_hash(max_depth, current_depth) }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
agave-client-0.1.3 lib/agave/local/field_type/links.rb
agave-client-0.1.2 lib/agave/local/field_type/links.rb
agave-client-0.1.1 lib/agave/local/field_type/links.rb
agave-client-0.1.0 lib/agave/local/field_type/links.rb