Sha256: c7e8fa0a1a5b968381a5d2135d2e9bebacd5ed93de51556077769c2043c30aba

Contents?: true

Size: 746 Bytes

Versions: 2

Compression:

Stored size: 746 Bytes

Contents

require 'slim'

module ActionView
  module TemplateHandlers
    raise "Slim supports only Rails 3.x and greater, your Rails version is #{Rails::VERSION::STRING}" if Rails::VERSION::MAJOR < 3

    if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR < 1
      # Slim handler for Rails 3.0
      class SlimHandler < TemplateHandler
        include Compilable

        def compile(template)
          Slim::Engine.new.compile(template.source)
        end
      end
    else
      # Slim handler for Rails 3.1 and greater
      class SlimHandler
        def call(template)
          Slim::Engine.new.compile(template.source)
        end
      end
    end
  end

  Template.register_default_template_handler :slim, TemplateHandlers::SlimHandler
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slim-0.7.3 lib/slim/rails.rb
slim-0.7.2 lib/slim/rails.rb