Class: Wings::ActiveFedoraAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/wings/converter_value_mapper.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ ActiveFedoraAttributes

Returns a new instance of ActiveFedoraAttributes.



248
249
250
251
# File 'lib/wings/converter_value_mapper.rb', line 248

def initialize(attributes)
  attributes = attributes.merge(file_name: attributes[:original_filename]) if attributes[:original_filename]
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



246
247
248
# File 'lib/wings/converter_value_mapper.rb', line 246

def attributes
  @attributes
end

Class Method Details

.mapped_attributes(attributes:) ⇒ Object



253
254
255
# File 'lib/wings/converter_value_mapper.rb', line 253

def self.mapped_attributes(attributes:)
  new(attributes).result
end

Instance Method Details

#resultObject



257
258
259
260
261
262
263
# File 'lib/wings/converter_value_mapper.rb', line 257

def result
  Hash[
    attributes.map do |value|
      ConverterValueMapper.for(value).result
    end.select(&:present?)
  ]
end