Sha256: bf919396e0e021692538523160d29c308568240e16bcf636cd9ae77187bebc13

Contents?: true

Size: 578 Bytes

Versions: 62

Compression:

Stored size: 578 Bytes

Contents

module CurationConcerns
  class VersionListPresenter
    def initialize(version_list)
      @raw_list = version_list
    end

    delegate :each, to: :wrapped_list

    private

      def wrapped_list
        @wrapped_list ||=
          @raw_list.map { |v| CurationConcerns::VersionPresenter.new(v) } # wrap each item in a presenter
                   .sort { |a, b| b.version.created <=> a.version.created } # sort list of versions based on creation date
                   .tap { |l| l.first.try(:current!) } # set the first version to the current version
      end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.7.7 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-2.0.0 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-2.0.0.rc2 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.7.6 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.7.5 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.7.4 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.7.3 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.7.2 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-2.0.0.rc1 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.7.1 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.7.0 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.7.0.beta1 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.6.3 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.6.2 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.6.1 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.6.0 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.5.0 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.4.0 app/presenters/curation_concerns/version_list_presenter.rb
curation_concerns-1.3.3 app/presenters/curation_concerns/version_list_presenter.rb