Sha256: f56ce16d03721f59d767d6859b62c22548e4de428e38ca88aa7ec0659a46bcc3

Contents?: true

Size: 552 Bytes

Versions: 4

Compression:

Stored size: 552 Bytes

Contents

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

module Agave
  module Local
    module FieldType
      class Gallery < Array
        def self.parse(value, repo)
          images = if value
                     value.map { |image| FieldType::File.parse(image, repo) }
                   else
                     []
                   end
          new(images)
        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/gallery.rb
agave-client-0.1.2 lib/agave/local/field_type/gallery.rb
agave-client-0.1.1 lib/agave/local/field_type/gallery.rb
agave-client-0.1.0 lib/agave/local/field_type/gallery.rb