Sha256: d07914fe283c1e1aca89f8fa30d1e01210031339617f43ff748ed9cc65c96432

Contents?: true

Size: 857 Bytes

Versions: 3

Compression:

Stored size: 857 Bytes

Contents

require "alephant/renderer/version"
require "alephant/renderer/view_mapper"
require "alephant/logger"

module Alephant
  module Renderer
    def self.create(config, data)
      Renderer.new(config, data)
    end

    class Renderer
      include Logger

      attr_reader :config, :data

      def initialize(config, data)
        @config = config
        @data   = data
      end

      def views
        mapper.generate data
      end

      private

      def mapper
        @mapper ||= ViewMapper.new(
          config[:renderer_id],
          config[:view_path]
        ).tap do
          logger.info(
            "event"      => "ViewMapperCreated",
            "rendererId" => config[:renderer_id],
            "viewPath"   => config[:view_path],
            "method"     => "#{self.class}#mapper"
          )
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alephant-renderer-3.0.0 lib/alephant/renderer.rb
alephant-renderer-2.0.3 lib/alephant/renderer.rb
alephant-renderer-2.0.2 lib/alephant/renderer.rb