Class: Hyrax::VersionPresenter
- Inherits:
-
Object
- Object
- Hyrax::VersionPresenter
- Defined in:
- app/presenters/hyrax/version_presenter.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
(also: #current?)
readonly
Returns the value of attribute current.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #committer ⇒ Object
- #created ⇒ Object
- #created_time ⇒ Object
- #current! ⇒ Object
-
#initialize(version) ⇒ VersionPresenter
constructor
A new instance of VersionPresenter.
- #label ⇒ Object
- #uri ⇒ Object
- #version_committer ⇒ Object
Constructor Details
#initialize(version) ⇒ VersionPresenter
Returns a new instance of VersionPresenter.
6 7 8 9 |
# File 'app/presenters/hyrax/version_presenter.rb', line 6 def initialize(version) @version = version @current = false end |
Instance Attribute Details
#current ⇒ Object (readonly) Also known as: current?
Returns the value of attribute current.
4 5 6 |
# File 'app/presenters/hyrax/version_presenter.rb', line 4 def current @current end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'app/presenters/hyrax/version_presenter.rb', line 4 def version @version end |
Instance Method Details
#committer ⇒ Object
39 40 41 |
# File 'app/presenters/hyrax/version_presenter.rb', line 39 def committer version_committer&.committer_login end |
#created ⇒ Object
26 27 28 |
# File 'app/presenters/hyrax/version_presenter.rb', line 26 def created @created ||= created_time&.in_time_zone&.to_formatted_s(:long_ordinal) || "Unknown" end |
#created_time ⇒ Object
30 31 32 |
# File 'app/presenters/hyrax/version_presenter.rb', line 30 def created_time version.try(:created) || version_committer.try(:created_at) end |
#current! ⇒ Object
14 15 16 |
# File 'app/presenters/hyrax/version_presenter.rb', line 14 def current! @current = true end |
#label ⇒ Object
18 19 20 |
# File 'app/presenters/hyrax/version_presenter.rb', line 18 def label version.try(:label) || version.version_id.to_s end |
#uri ⇒ Object
22 23 24 |
# File 'app/presenters/hyrax/version_presenter.rb', line 22 def uri version.try(:uri) || version.version_id.to_s end |
#version_committer ⇒ Object
34 35 36 37 |
# File 'app/presenters/hyrax/version_presenter.rb', line 34 def version_committer Hyrax::VersionCommitter .find_by(version_id: @version.try(:uri) || @version.try(:version_id)) end |