Sha256: 746e08876ae14adb0a2c2e2d57bd80950e02e47c8d9d7d0fe0b0e6bf9ba11766

Contents?: true

Size: 401 Bytes

Versions: 3

Compression:

Stored size: 401 Bytes

Contents

# frozen_string_literal: true
module Dato
  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
          map(&:to_hash)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dato-0.3.6 lib/dato/local/field_type/links.rb
dato-0.3.5 lib/dato/local/field_type/links.rb
dato-0.3.3 lib/dato/local/field_type/links.rb