Class: Hyrax::Actors::InterpretVisibilityActor::Intention

Inherits:
VisibilityIntention show all
Defined in:
app/actors/hyrax/actors/interpret_visibility_actor.rb

Constant Summary

Constants inherited from VisibilityIntention

VisibilityIntention::EMBARGO_REQUEST, VisibilityIntention::LEASE_REQUEST, VisibilityIntention::PRIVATE, VisibilityIntention::PUBLIC

Instance Attribute Summary

Attributes inherited from VisibilityIntention

#after, #during, #release_date, #visibility

Instance Method Summary collapse

Methods inherited from VisibilityIntention

#embargo_params, #lease_params, #valid_embargo?, #valid_lease?, #wants_embargo?, #wants_lease?

Constructor Details

#initialize(attributes) ⇒ Intention

Returns a new instance of Intention.



6
7
8
9
10
# File 'app/actors/hyrax/actors/interpret_visibility_actor.rb', line 6

def initialize(attributes)
  @attributes = attributes

  instance_vars_from_attributes
end

Instance Method Details

#sanitize_paramsObject

returns a copy of attributes with the necessary params removed If the lease or embargo is valid, or if they selected something besides lease or embargo, remove all the params.



15
16
17
18
19
20
21
22
23
24
25
# File 'app/actors/hyrax/actors/interpret_visibility_actor.rb', line 15

def sanitize_params
  if valid_lease?
    sanitize_lease_params
  elsif valid_embargo?
    sanitize_embargo_params
  elsif !wants_lease? && !wants_embargo?
    sanitize_unrestricted_params
  else
    @attributes
  end
end