Sha256: 69df9fcb7c78aa46da0d69801eafbe65b8ea569eaf97000083d28e56d45f60d9
Contents?: true
Size: 750 Bytes
Versions: 29
Compression:
Stored size: 750 Bytes
Contents
# frozen_string_literal: true 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
29 entries across 29 versions & 1 rubygems