Sha256: 8d68b424dfda945d8f392352d61f5dcfd6b90b4613d29a19fcbeffcd1efdc54c

Contents?: true

Size: 1.03 KB

Versions: 132

Compression:

Stored size: 1.03 KB

Contents

require 'tilt/template'

module Tilt
  # Radius Template
  # http://github.com/jlong/radius/
  class RadiusTemplate < Template
    def self.engine_initialized?
      defined? ::Radius
    end

    def self.context_class
      @context_class ||= Class.new(Radius::Context) do
        attr_accessor :tilt_scope

        def tag_missing(name, attributes)
          tilt_scope.__send__(name)
        end

        def dup
          i = super
          i.tilt_scope = tilt_scope
          i
        end
      end
    end

    def initialize_engine
      require_template_library 'radius'
    end

    def prepare
    end

    def evaluate(scope, locals, &block)
      context = self.class.context_class.new
      context.tilt_scope = scope
      context.define_tag("yield") do
        block.call
      end
      locals.each do |tag, value|
        context.define_tag(tag) do
          value
        end
      end

      options = {:tag_prefix => 'r'}.merge(@options)
      parser = Radius::Parser.new(context, options)
      parser.parse(data)
    end
  end
end

Version data entries

132 entries across 115 versions & 18 rubygems

Version Path
backbone-queryparams-rails-0.0.1 vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
railscast-assets-0.0.2 vendor/bundle/gems/backbone-forms-on-rails-0.10.0/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
railscast-assets-0.0.2 vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
backbone-forms-on-rails-0.10.0 vendor/bundle/gems/backbone-forms-on-rails-0.10.0/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
backbone-forms-on-rails-0.10.0 vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
backbone-deep-rails-0.0.1 vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
challah-0.9.1.beta vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/radius.rb
challah-0.9.0 vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
classiccms-0.6.9 vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.3/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.3/vendor/bundle/gems/jquery_regex-0.0.1/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.3/vendor/bundle/gems/jquery_regex-0.0.2/vendor/bundle/gems/jquery_regex-0.0.1/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.3/vendor/bundle/gems/jquery_regex-0.0.2/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.1/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.2/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.2/vendor/bundle/gems/jquery_regex-0.0.1/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
jquery_regex-0.0.3 vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
jquery_regex-0.0.1 vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/tilt-1.3.3/lib/tilt/radius.rb