Sha256: 69de4ae25fb4991bfe54a41f97e1b937b6c438198e71b21667184061c83062b8

Contents?: true

Size: 909 Bytes

Versions: 4

Compression:

Stored size: 909 Bytes

Contents

if ::Rails::VERSION::MAJOR < 3
  raise "Temple supports only Rails 3.x and greater, your Rails version is #{::Rails::VERSION::STRING}"
end

module Temple
  module Templates
    if ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR < 1
      class Rails < ActionView::TemplateHandler
        include ActionView::TemplateHandlers::Compilable
        extend Mixins::Template

        def compile(template)
          self.class.build_engine.call(template.source)
        end

        def self.register_as(name)
          ActionView::Template.register_template_handler name.to_sym, self
        end
      end
    else
      class Rails
        extend Mixins::Template

        def self.call(template)
          build_engine.call(template.source)
        end

        def self.register_as(name)
          ActionView::Template.register_template_handler name.to_sym, self
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
temple-0.3.2 lib/temple/templates/rails.rb
temple-0.3.1 lib/temple/templates/rails.rb
temple-0.3.0 lib/temple/templates/rails.rb
temple-0.2.0 lib/temple/templates/rails.rb