Sha256: a5f7b531562989b7b7e049a9c11faea0fb6cb6e939337b754120cd9c8812b66c

Contents?: true

Size: 433 Bytes

Versions: 11

Compression:

Stored size: 433 Bytes

Contents

module Ddr::Models
  class AttachedFilesProfile
    include ActiveModel::Serializers::JSON

    attr_reader :object

    def initialize(object)
      @object = object
    end

    def attributes
      files.keys.map { |k| [k, nil] }.to_h
    end

    def read_attribute_for_serialization(key)
      AttachedFileProfile.new(files[key])
    end

    private

    def files
      object.attached_files_having_content
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ddr-models-3.0.8 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.7 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.6 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.5 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.4 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.3 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.2 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.1 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.rc6 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.rc5 lib/ddr/models/attached_files_profile.rb