Module: Hyrax::WithEmbargoesAndLeases

Extended by:
ActiveSupport::Concern
Included in:
Resource
Defined in:
app/models/concerns/hyrax/with_embargoes_and_leases.rb

Instance Method Summary collapse

Instance Method Details

#embargoObject



13
14
15
16
# File 'app/models/concerns/hyrax/with_embargoes_and_leases.rb', line 13

def embargo
  return @embargo if @embargo
  @embargo = Hyrax.query_service.find_by(id: embargo_id) if embargo_id.present?
end

#embargo=(value) ⇒ Object



6
7
8
9
10
11
# File 'app/models/concerns/hyrax/with_embargoes_and_leases.rb', line 6

def embargo=(value)
  raise TypeError "can't convert #{value.class} into Hyrax::Embargo" unless value.is_a? Hyrax::Embargo

  @embargo = value
  self.embargo_id = @embargo.id
end

#leaseObject



25
26
27
28
# File 'app/models/concerns/hyrax/with_embargoes_and_leases.rb', line 25

def lease
  return @lease if @lease
  @lease = Hyrax.query_service.find_by(id: lease_id) if lease_id.present?
end

#lease=(value) ⇒ Object



18
19
20
21
22
23
# File 'app/models/concerns/hyrax/with_embargoes_and_leases.rb', line 18

def lease=(value)
  raise TypeError "can't convert #{value.class} into Hyrax::Lease" unless value.is_a? Hyrax::Lease

  @lease = value
  self.lease_id = @lease.id
end