Class: Hyrax::LeasePresenter
- Inherits:
-
Object
- Object
- Hyrax::LeasePresenter
- Includes:
- ModelProxy
- Defined in:
- app/presenters/hyrax/lease_presenter.rb
Overview
Presents leased objects
Instance Attribute Summary collapse
-
#solr_document ⇒ Object
Returns the value of attribute solr_document.
Instance Method Summary collapse
- #enforced? ⇒ Boolean
-
#initialize(solr_document) ⇒ LeasePresenter
constructor
A new instance of LeasePresenter.
- #lease_expiration_date ⇒ Object
- #lease_history ⇒ Object
- #visibility_after_lease ⇒ Object
Methods included from ModelProxy
#persisted?, #to_model, #valid_child_concerns
Constructor Details
#initialize(solr_document) ⇒ LeasePresenter
Returns a new instance of LeasePresenter.
11 12 13 |
# File 'app/presenters/hyrax/lease_presenter.rb', line 11 def initialize(solr_document) @solr_document = solr_document end |
Instance Attribute Details
#solr_document ⇒ Object
Returns the value of attribute solr_document.
6 7 8 |
# File 'app/presenters/hyrax/lease_presenter.rb', line 6 def solr_document @solr_document end |
Instance Method Details
#enforced? ⇒ Boolean
31 32 33 |
# File 'app/presenters/hyrax/lease_presenter.rb', line 31 def enforced? solr_document.lease_enforced? end |
#lease_expiration_date ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/presenters/hyrax/lease_presenter.rb', line 15 def lease_expiration_date if solr_document.lease_expiration_date solr_document.lease_expiration_date.to_formatted_s(:rfc822) else solr_document.keys end end |
#lease_history ⇒ Object
27 28 29 |
# File 'app/presenters/hyrax/lease_presenter.rb', line 27 def lease_history solr_document['lease_history_ssim'] end |
#visibility_after_lease ⇒ Object
23 24 25 |
# File 'app/presenters/hyrax/lease_presenter.rb', line 23 def visibility_after_lease solr_document.fetch('visibility_after_lease_ssim', []).first end |