Sha256: c93e04e1fe828b234fd8e54c385a70c5d17c814fe38c7d6c9906d01982c5cdc8

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

require 'tilt'

module Packr
  module Rails
    class Template < Tilt::Template
      self.default_mime_type = 'application/javascript'

      def self.engine_initialized?
        defined?(::Packr)
      end

      def initialize_engine
        require_template_library 'packr'
      end

      def syntax
        :packr
      end

      def prepare
      end

      def evaluate(scope, locals, &block)
        Packr.pack(data, packr_options(scope))
      end

      def packr_options(scope)
        packr_options_from_rails(scope)
      end

      def packr_options_from_rails(scope)
        scope.environment.context_class.packr_config
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
packr-rails-0.0.1 lib/packr/rails/template.rb