Sha256: f032ae8aa06042817bb1e60cf3a8719572425130b2f0ae73300d41098cf3ba51

Contents?: true

Size: 655 Bytes

Versions: 6

Compression:

Stored size: 655 Bytes

Contents

# Makes Petroglyph available through Tilt.
# Also contains a utility function that will
# be added to Sinatra if Sinatra is defined.

require 'tilt'
require 'petroglyph'

module Tilt
  class PetroglyphTemplate < Template
    self.default_mime_type = "application/json"
    def initialize_engine
      return if defined? ::Petroglyph
      require_template_library 'petroglyph'
    end

    def prepare; end

    def precompiled_template(locals)
      data.to_str
    end

    def evaluate(scope = Object.new, locals = {}, &block)
      Petroglyph::Engine.new(data).render(scope, locals, file, &block)
    end
  end
  register PetroglyphTemplate, 'pg'
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
petroglyph-0.0.6 lib/tilt/petroglyph.rb
petroglyph-0.0.5 lib/tilt/petroglyph.rb
petroglyph-0.0.4 lib/tilt/petroglyph.rb
petroglyph-0.0.3 lib/tilt/petroglyph.rb
petroglyph-0.0.2 lib/tilt/petroglyph.rb
petroglyph-0.0.1 lib/tilt/petroglyph.rb