Class: Hyrax::VersionListPresenter

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
app/presenters/hyrax/version_list_presenter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version_list) ⇒ VersionListPresenter

Returns a new instance of VersionListPresenter.

Parameters:

  • version_list (Array<#created>)

10
11
12
# File 'app/presenters/hyrax/version_list_presenter.rb', line 10

def initialize(version_list)
  @raw_list = version_list
end

Class Method Details

.for(file_set:) ⇒ Enumerable<Hyrax::VersionPresenter>

Returns an enumerable of presenters for the relevant file versions.

Parameters:

  • an (Object)

    object representing the File Set

Returns:

Raises:

  • (ArgumentError)

    if we can't build an enu


21
22
23
24
25
# File 'app/presenters/hyrax/version_list_presenter.rb', line 21

def self.for(file_set:)
  new(file_set.original_file&.versions&.all.to_a)
rescue NoMethodError
  raise ArgumentError
end