Class: CurationConcerns::SingleUseLinkPresenter
- Inherits:
-
Object
- Object
- CurationConcerns::SingleUseLinkPresenter
- Includes:
- ActionView::Helpers::TranslationHelper
- Defined in:
- app/presenters/curation_concerns/single_use_link_presenter.rb
Instance Attribute Summary collapse
-
#link ⇒ Object
readonly
Returns the value of attribute link.
Instance Method Summary collapse
- #human_readable_expiration ⇒ Object
-
#initialize(link) ⇒ SingleUseLinkPresenter
constructor
A new instance of SingleUseLinkPresenter.
- #link_type ⇒ Object
- #short_key ⇒ Object
- #url_helper ⇒ Object
Constructor Details
#initialize(link) ⇒ SingleUseLinkPresenter
Returns a new instance of SingleUseLinkPresenter.
10 11 12 |
# File 'app/presenters/curation_concerns/single_use_link_presenter.rb', line 10 def initialize(link) @link = link end |
Instance Attribute Details
#link ⇒ Object (readonly)
Returns the value of attribute link.
5 6 7 |
# File 'app/presenters/curation_concerns/single_use_link_presenter.rb', line 5 def link @link end |
Instance Method Details
#human_readable_expiration ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/presenters/curation_concerns/single_use_link_presenter.rb', line 14 def human_readable_expiration if hours < 1 t('curation_concerns.single_use_links.expiration.lesser_time') else t('curation_concerns.single_use_links.expiration.time', value: hours) end end |
#link_type ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/presenters/curation_concerns/single_use_link_presenter.rb', line 26 def link_type if download? t('curation_concerns.single_use_links.download.type') else t('curation_concerns.single_use_links.show.type') end end |
#short_key ⇒ Object
22 23 24 |
# File 'app/presenters/curation_concerns/single_use_link_presenter.rb', line 22 def short_key link.downloadKey.first(6) end |
#url_helper ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/presenters/curation_concerns/single_use_link_presenter.rb', line 34 def url_helper if download? "download_single_use_link_url" else "show_single_use_link_url" end end |