Class: RichTextRendererFactory
- Inherits:
-
Object
- Object
- RichTextRendererFactory
- Defined in:
- lib/wcc/contentful/rich_text_renderer_factory.rb
Overview
Constructs new connected RichTextRenderer instances w/ needed dependencies
Instance Method Summary collapse
- #call(document) ⇒ Object
-
#initialize(implementation_class, services: WCC::Contentful::Services.instance) ⇒ RichTextRendererFactory
constructor
A new instance of RichTextRendererFactory.
- #new(document) ⇒ Object
Constructor Details
#initialize(implementation_class, services: WCC::Contentful::Services.instance) ⇒ RichTextRendererFactory
Returns a new instance of RichTextRendererFactory.
5 6 7 8 |
# File 'lib/wcc/contentful/rich_text_renderer_factory.rb', line 5 def initialize(implementation_class, services: WCC::Contentful::Services.instance) @implementation_class = implementation_class @services = services end |
Instance Method Details
#call(document) ⇒ Object
17 18 19 |
# File 'lib/wcc/contentful/rich_text_renderer_factory.rb', line 17 def call(document) new(document).call end |
#new(document) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/wcc/contentful/rich_text_renderer_factory.rb', line 10 def new(document) @implementation_class.new(document).tap do |renderer| # Inject any dependencies that the renderer needs (except itself to avoid infinite recursion) @services.inject_into(renderer, except: [:rich_text_renderer]) end end |