Sha256: 1efa1a06512facfb6aa6e36c6c9ebb78eb718ae853805e41adbf954737d7a3f3
Contents?: true
Size: 620 Bytes
Versions: 8
Compression:
Stored size: 620 Bytes
Contents
# frozen_string_literal: true # Constructs new connected RichTextRenderer instances w/ needed dependencies class RichTextRendererFactory def initialize(implementation_class, services: WCC::Contentful::Services.instance) @implementation_class = implementation_class @services = services end 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 def call(document) new(document).call end end
Version data entries
8 entries across 8 versions & 1 rubygems