Class: Hyrax::VisibilityPropagator::NullVisibilityPropagator

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

Overview

Provides a null/logging implementation of the visibility propagator.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:) ⇒ NullVisibilityPropagator

Returns a new instance of NullVisibilityPropagator.

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

#propagatevoid

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 propagate
  message =  "Tried to propagate 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