Sha256: f9d33a4ed045190304333998729820a880d8f0f4a162cfb1f4fa5c50b419c820

Contents?: true

Size: 535 Bytes

Versions: 20

Compression:

Stored size: 535 Bytes

Contents

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

    attr_reader :files_hash

    # @param files_hash [ActiveFedora::FilesHash]
    def initialize(files_hash)
      @files_hash = files_hash
    end

    def attributes
      files_hash.keys.each_with_object({}) do |key, memo|
        unless files_hash[key].destroyed?
          memo[key.to_s] = nil
        end
      end
    end

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

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ddr-models-3.0.0.rc4 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.rc3 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.rc2 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.rc1 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.22 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.21 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.20 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.18 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.17 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.16 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.15 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.14 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.13 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.12 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.11 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.10 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.9 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.8 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.7 lib/ddr/models/attached_files_profile.rb
ddr-models-3.0.0.beta.6 lib/ddr/models/attached_files_profile.rb