Sha256: 393e0c91294a4b74a4f87a40a5f66287889454b44d5737aa3e55ce4bd1e41823

Contents?: true

Size: 781 Bytes

Versions: 30

Compression:

Stored size: 781 Bytes

Contents

require 'ruhl'

module Sinatra
  module Templates
    def ruhl(template, options = {}, locals = {})
      require_warn('Ruhl') unless defined?(::Ruhl::Engine)

      render :ruhl, template, options, locals
    end

    private

    def render(engine, template, options={}, locals={})
      # merge app-level options
      options = self.class.send(engine).merge(options) if self.class.respond_to?(engine)

      views = options.delete(:views) || self.class.views || "./views"

      # render template
      data, options[:filename], options[:line] = lookup_template(engine, template, views)

      __send__("render_#{engine}", template, data, options)
    end
    
    def render_ruhl(template, data, options)
      ::Ruhl::Engine.new(data, options).render(self)
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
ruhl-0.22.0 lib/ruhl/sinatra.rb
ruhl-0.21.0 lib/ruhl/sinatra.rb
ruhl-0.20.0 lib/ruhl/sinatra.rb
ruhl-0.19.0 lib/ruhl/sinatra.rb
ruhl-0.18.0 lib/ruhl/sinatra.rb
ruhl-0.17.0 lib/ruhl/sinatra.rb
ruhl-0.16.0 lib/ruhl/sinatra.rb
ruhl-0.15.0 lib/ruhl/sinatra.rb
ruhl-0.14.0 lib/ruhl/sinatra.rb
ruhl-0.13.0 lib/ruhl/sinatra.rb
ruhl-0.12.1 lib/ruhl/sinatra.rb
ruhl-0.12.0 lib/ruhl/sinatra.rb
ruhl-0.11.2 lib/ruhl/sinatra.rb
ruhl-0.11.1 lib/ruhl/sinatra.rb
ruhl-0.11.0 lib/ruhl/sinatra.rb
ruhl-0.10.1 lib/ruhl/sinatra.rb
ruhl-0.10.0 lib/ruhl/sinatra.rb
ruhl-0.9.7 lib/ruhl/sinatra.rb
ruhl-0.9.6 lib/ruhl/sinatra.rb
ruhl-0.9.5 lib/ruhl/sinatra.rb