Sha256: 1c0b3f320cf9da9a9adf677408afdb89781f0c6e0be1dff3d91c2524b9ba46e7
Contents?: true
Size: 720 Bytes
Versions: 58
Compression:
Stored size: 720 Bytes
Contents
module Hyrax ## # Dynamic presenter which instantiates a file set presenter if given an object # with a given ID, but otherwise instantiates a work presenter. class CompositePresenterFactory attr_reader :file_set_presenter_class, :work_presenter_class, :file_set_ids def initialize(file_set_presenter_class, work_presenter_class, file_set_ids) @file_set_presenter_class = file_set_presenter_class @work_presenter_class = work_presenter_class @file_set_ids = file_set_ids end def new(*args) obj = args.first if file_set_ids.include?(obj.id) file_set_presenter_class.new(*args) else work_presenter_class.new(*args) end end end end
Version data entries
58 entries across 58 versions & 2 rubygems