Sha256: e2a89f3bd76d07bb4f80764bfb67561ac1488ca523bd4b98318e0466dfcb0133

Contents?: true

Size: 619 Bytes

Versions: 7

Compression:

Stored size: 619 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

7 entries across 7 versions & 1 rubygems

Version Path
handlebars_assets-0.4.0 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.3.1 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.3.0 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.2.0 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.1.4 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.1.3 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.1.2 lib/handlebars_assets/handlebars.rb