Sha256: ece318f37b0263f0fa60bb6b32df8e63c078e891a94f9ddc6045c4628f8398c1

Contents?: true

Size: 478 Bytes

Versions: 3

Compression:

Stored size: 478 Bytes

Contents

# frozen_string_literal: true
require 'dato/local/field_type/file'

module Dato
  module Local
    module FieldType
      class Gallery < Array
        def self.parse(value, repo)
          images = if value
                     value.map { |image| FieldType::Image.parse(image, repo) }
                   else
                     []
                   end
          new(images)
        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/gallery.rb
dato-0.3.5 lib/dato/local/field_type/gallery.rb
dato-0.3.3 lib/dato/local/field_type/gallery.rb