Sha256: ab9665ab05267310ca915ee5860870cca21603f25bd2c5e4790fdf3bb63c28c0

Contents?: true

Size: 1.11 KB

Versions: 191

Compression:

Stored size: 1.11 KB

Contents

require 'tilt/template'
require 'coffee_script'

module Tilt
  # CoffeeScript template implementation. See:
  # http://coffeescript.org/
  #
  # CoffeeScript templates do not support object scopes, locals, or yield.
  class CoffeeScriptTemplate < Template
    self.default_mime_type = 'application/javascript'

    @@default_bare = false

    def self.default_bare
      @@default_bare
    end

    def self.default_bare=(value)
      @@default_bare = value
    end

    # DEPRECATED
    def self.default_no_wrap
      @@default_bare
    end

    # DEPRECATED
    def self.default_no_wrap=(value)
      @@default_bare = value
    end

    def self.literate?
      false
    end

    def prepare
      if !options.key?(:bare) and !options.key?(:no_wrap)
        options[:bare] = self.class.default_bare
      end
      options[:literate] ||= self.class.literate?
    end

    def evaluate(scope, locals, &block)
      @output ||= CoffeeScript.compile(data, options)
    end

    def allows_script?
      false
    end
  end

  class CoffeeScriptLiterateTemplate < CoffeeScriptTemplate
    def self.literate?
      true
    end
  end
end

Version data entries

191 entries across 152 versions & 25 rubygems

Version Path
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/tilt-2.0.10/lib/tilt/coffee.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
brakeman-4.7.0 bundle/ruby/2.6.0/gems/tilt-2.0.10/lib/tilt/coffee.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/tilt-2.0.10/lib/tilt/coffee.rb
tilt-2.0.10 lib/tilt/coffee.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/tilt-2.0.9/lib/tilt/coffee.rb