Sha256: b2d23e6b2ac9eabf407af35c460f3d6b519c2bf3459c98b4d4a745a4333ed260

Contents?: true

Size: 830 Bytes

Versions: 33

Compression:

Stored size: 830 Bytes

Contents

module Linner
  module Wrapper
    class Module
      def self.wrap(name, content)
<<-WRAPPER
this.require.define({"#{name}":function(exports, require, module){#{content};}});
WRAPPER
      end

      def self.definition
        File.read(File.join File.dirname(__FILE__), "../../vendor", "require_definition.js")
      end
    end

    class Template
      def self.wrap(name, content)
<<-WRAPPER
templates["#{name}"] = template(#{content});
WRAPPER
      end

      def self.partial_wrap(name, content)
<<-PARTIAL
Handlebars.registerPartial("#{name}", Handlebars.template(#{content}));
PARTIAL
      end


      def self.definition(content)
<<-DEFINITION
(function() {
  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  #{content}
})();
DEFINITION
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
linner-hc-1.0.0 lib/linner/wrapper.rb
linner-0.12.0 lib/linner/wrapper.rb
linner-0.11.6 lib/linner/wrapper.rb
linner-0.11.5 lib/linner/wrapper.rb
linner-0.11.4 lib/linner/wrapper.rb
linner-0.11.3 lib/linner/wrapper.rb
linner-0.11.2 lib/linner/wrapper.rb
linner-0.11.1 lib/linner/wrapper.rb
linner-0.11.0 lib/linner/wrapper.rb
linner-0.10.0 lib/linner/wrapper.rb
linner-0.9.1 lib/linner/wrapper.rb
linner-0.9.0 lib/linner/wrapper.rb
linner-0.8.7 lib/linner/wrapper.rb
linner-0.8.6 lib/linner/wrapper.rb
linner-0.8.5 lib/linner/wrapper.rb
linner-0.8.4 lib/linner/wrapper.rb
linner-0.8.3 lib/linner/wrapper.rb
linner-0.8.2 lib/linner/wrapper.rb
linner-0.8.1 lib/linner/wrapper.rb
linner-0.8.0 lib/linner/wrapper.rb