Class: Hyrax::VersionListPresenter
- Inherits:
-
Object
- Object
- Hyrax::VersionListPresenter
- Includes:
- Enumerable
- Defined in:
- app/presenters/hyrax/version_list_presenter.rb
Instance Attribute Summary collapse
- #versioning_service ⇒ Object readonly
Class Method Summary collapse
-
.for(file_set:, file_service: Hyrax.config.file_set_file_service) ⇒ Hyrax::VersionListPresenter
An enumerable of presenters for the relevant file versions.
Instance Method Summary collapse
-
#initialize(service) ⇒ VersionListPresenter
constructor
A new instance of VersionListPresenter.
Constructor Details
#initialize(service) ⇒ VersionListPresenter
Returns a new instance of VersionListPresenter.
12 13 14 |
# File 'app/presenters/hyrax/version_list_presenter.rb', line 12 def initialize(service) @versioning_service = service end |
Instance Attribute Details
#versioning_service ⇒ Object (readonly)
8 9 10 |
# File 'app/presenters/hyrax/version_list_presenter.rb', line 8 def versioning_service @versioning_service end |
Class Method Details
.for(file_set:, file_service: Hyrax.config.file_set_file_service) ⇒ Hyrax::VersionListPresenter
Returns an enumerable of presenters for the relevant file versions.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/presenters/hyrax/version_list_presenter.rb', line 23 def self.for(file_set:, file_service: Hyrax.config.file_set_file_service) original_file = case file_set when ActiveFedora::Base file_set.original_file else file_service.new(file_set: file_set).primary_file end new(Hyrax::VersioningService.new(resource: original_file)) rescue NoMethodError raise ArgumentError end |