Class: Arclight::Viewer

Inherits:
Object
  • Object
show all
Defined in:
lib/arclight/viewer.rb

Overview

Arclight::Viewer provides the ability to render a configured viewer The viewer class is configured through the Arclight::Engine configuration which allows an application to implement their own viewer class. This class will receive a SolrDocument and must implement to_partial_path. See Arclight::Viewers::OEmbed for an example implementation of a viewer.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document) ⇒ Viewer

Returns a new instance of Viewer.



17
18
19
# File 'lib/arclight/viewer.rb', line 17

def initialize(document)
  @document = document
end

Class Method Details

.render(document) ⇒ Object



13
14
15
# File 'lib/arclight/viewer.rb', line 13

def self.render(document)
  new(document).render
end

Instance Method Details

#renderObject



21
22
23
24
25
26
27
# File 'lib/arclight/viewer.rb', line 21

def render
  renderer.render(
    viewer_instance.to_partial_path,
    layout: false,
    locals: { viewer: viewer_instance }
  )
end