Class: Hyrax::VisibilityPropagator::NullVisibilityPropogator

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/visibility_propagator.rb

Overview

Provides a null/logging implementation of the visibility propogator.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:) ⇒ NullVisibilityPropogator

Returns a new instance of NullVisibilityPropogator.

Parameters:

  • source (#visibility)

    the object to propagate visibility from


32
33
34
# File 'app/services/hyrax/visibility_propagator.rb', line 32

def initialize(source:)
  self.source = source
end

Instance Attribute Details

#source#visibility

Returns:

  • (#visibility)

28
29
30
# File 'app/services/hyrax/visibility_propagator.rb', line 28

def source
  @source
end

Instance Method Details

#propogatevoid

This method returns an undefined value.

Raises:

  • (RuntimeError)

    if we're in development mode


39
40
41
42
43
44
45
46
# File 'app/services/hyrax/visibility_propagator.rb', line 39

def propogate
  message =  "Tried to propogate visibility to members of #{source} " \
             "but didn't know what kind of object it is. Model " \
             "name #{source.try(:model_name)}. Called from #{caller[0]}."

  Hyrax.logger.warn(message)
  Rails.env.development? ? raise(message) : :noop
end