Class: Blacklight::Rendering::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/blacklight/rendering/pipeline.rb

Overview

The field rendering pipeline. This takes a field and its values and transforms them through a list of operations.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values, config, document, context, operations, options) ⇒ Pipeline

Returns a new instance of Pipeline.

Parameters:

  • values (Array)

    the values for the field

  • config (Blacklight::Configuration::Field)

    the field’s configuration

  • document (SolrDocument)

    the document

  • context (Object)

    an execution context, used to execute the helper method in.

  • operations (Array<Class>)

    the list of operations in this Pipeline

  • options (Hash)

    options to pass to the processors. Typically only ‘:value` is used



20
21
22
23
24
25
26
27
# File 'app/presenters/blacklight/rendering/pipeline.rb', line 20

def initialize(values, config, document, context, operations, options)
  @values = values
  @config = config
  @document = document
  @context = context
  @operations = operations
  @options = options
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



29
30
31
# File 'app/presenters/blacklight/rendering/pipeline.rb', line 29

def config
  @config
end

#contextObject (readonly)

Returns the value of attribute context.



29
30
31
# File 'app/presenters/blacklight/rendering/pipeline.rb', line 29

def context
  @context
end

#documentObject (readonly)

Returns the value of attribute document.



29
30
31
# File 'app/presenters/blacklight/rendering/pipeline.rb', line 29

def document
  @document
end

#operationsObject (readonly)

Returns the value of attribute operations.



29
30
31
# File 'app/presenters/blacklight/rendering/pipeline.rb', line 29

def operations
  @operations
end

#optionsObject (readonly)

Returns the value of attribute options.



29
30
31
# File 'app/presenters/blacklight/rendering/pipeline.rb', line 29

def options
  @options
end

#valuesObject (readonly)

Returns the value of attribute values.



29
30
31
# File 'app/presenters/blacklight/rendering/pipeline.rb', line 29

def values
  @values
end

Class Method Details

.render(values, config, document, context, options) ⇒ Object

Parameters:

  • values (Array)

    the values for the field

  • config (Blacklight::Configuration::Field)

    the field’s configuration

  • document (SolrDocument)

    the document

  • context (Object)

    an execution context, used to execute the helper method in.

  • options (Hash)

    options to pass to the processors. Typically only ‘:value` is used



36
37
38
# File 'app/presenters/blacklight/rendering/pipeline.rb', line 36

def self.render(values, config, document, context, options)
  new(values, config, document, context, operations, options).render
end

Instance Method Details

#renderObject

Perform the processing by the pipeline



41
42
43
44
# File 'app/presenters/blacklight/rendering/pipeline.rb', line 41

def render
  first, *rest = *stack
  first.new(values, config, document, context, options, rest).render
end