Sha256: f0d0b661a66bba81bd821cf7fcbb9943ecd2ad931f47c3c63e9b082697f13996

Contents?: true

Size: 575 Bytes

Versions: 6

Compression:

Stored size: 575 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('handlebars.js')
      end

      def assets_path
        @assets_path ||= Pathname(HandlebarsAssets.path)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
handlebars_assets-0.6.2 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.6.1 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.5.0 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.4.4 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.4.3 lib/handlebars_assets/handlebars.rb
handlebars_assets-0.4.1 lib/handlebars_assets/handlebars.rb