Class: Mariner::Renderer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/mariner/renderer/base.rb

Overview

Public: The base class for renderers used in a rendering strategy.

Examples:

class FakeRenderingStrategy

  def factory(type, subject)
    case type
    when :group then FakeRenderer.new(subject, self)
    ...

  class FakeRenderer < Mariner::Renderer::Base

    def render
      ...

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject, rendering_strategy) ⇒ Base

Public: Creates a new renderer and assigns #subject and #rendering_strategy



34
35
36
# File 'lib/mariner/renderer/base.rb', line 34

def initialize(subject, rendering_strategy)
  @subject, @rendering_strategy = subject, rendering_strategy
end

Instance Attribute Details

#rendering_strategyObject

Public: The rendering strategy used that responds to #factory



29
30
31
# File 'lib/mariner/renderer/base.rb', line 29

def rendering_strategy
  @rendering_strategy
end

#subjectObject

Public: The subject (a Store or a Url) to render



25
26
27
# File 'lib/mariner/renderer/base.rb', line 25

def subject
  @subject
end