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, #valid_child_concerns

Constructor Details

#initialize(solr_document) ⇒ LeasePresenter

Returns a new instance of LeasePresenter.

Parameters:



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_documentObject

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

#lease_expiration_dateObject



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_historyObject



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

def lease_history
  solr_document['lease_history_ssim']
end

#visibility_after_leaseObject



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