Class: Hyrax::LeasePresenter

Inherits:
Object
  • Object
show all
Includes:
ModelProxy
Defined in:
app/presenters/hyrax/lease_presenter.rb

Overview

Presents leased objects

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ModelProxy

#persisted?, #to_model, #to_partial_path

Constructor Details

#initialize(solr_document) ⇒ LeasePresenter

Returns a new instance of LeasePresenter.

Parameters:



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

def initialize(solr_document)
  @solr_document = solr_document
end

Instance Attribute Details

#solr_documentObject

Returns the value of attribute solr_document.



5
6
7
# File 'app/presenters/hyrax/lease_presenter.rb', line 5

def solr_document
  @solr_document
end

Instance Method Details

#lease_expiration_dateObject



14
15
16
17
18
19
20
# File 'app/presenters/hyrax/lease_presenter.rb', line 14

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_historyObject



26
27
28
# File 'app/presenters/hyrax/lease_presenter.rb', line 26

def lease_history
  solr_document['lease_history_ssim']
end

#visibility_after_leaseObject



22
23
24
# File 'app/presenters/hyrax/lease_presenter.rb', line 22

def visibility_after_lease
  solr_document.fetch('visibility_after_lease_ssim', []).first
end