Sha256: 587aedee2b7c7cf6f89febc62abbb7b3d980d0cc0c918677e326612c080f117a

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

# Based on https://github.com/josh/ruby-coffee-script
require 'execjs'
require 'pathname'

module HandlebarsAssets
  class Handlebars
    class << self
      def precompile(*args)
        context.call('Handlebars.precompile', *args)
      end

      private
      def context
        @context ||= ExecJS.compile(source)
      end

      def source
        @source ||= path.read
      end

      def path
        @path ||= assets_path.join('javascripts', 'handlebars.js')
      end

      def assets_path
        @assets_path ||= Pathname(__FILE__).dirname.join('..','..','vendor','assets')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
handlebars_assets-0.1.1 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.1.0 lib/handlebars_assets/handlebars.rb