Sha256: e16e9e9d02eebbf37f5a15c35164adcfa0be940d462dc3832078e11c1e617fbd

Contents?: true

Size: 857 Bytes

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
alephant-renderer-2.0.1 lib/alephant/renderer.rb
alephant-renderer-2.0.0 lib/alephant/renderer.rb