Class: Mariner::Renderer::Base
- Inherits:
-
Object
- Object
- Mariner::Renderer::Base
- 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
...
Direct Known Subclasses
UnorderedListRenderer::GroupRenderer, UnorderedListRenderer::ItemRenderer
Instance Attribute Summary collapse
-
#rendering_strategy ⇒ Object
Public: The rendering strategy used that responds to #factory.
-
#subject ⇒ Object
Public: The subject (a Store or a Url) to render.
Instance Method Summary collapse
-
#initialize(subject, rendering_strategy) ⇒ Base
constructor
Public: Creates a new renderer and assigns #subject and #rendering_strategy.
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_strategy ⇒ Object
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 |
#subject ⇒ Object
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 |