Sha256: c02b311adc491fd86085976b34b576cca46d5ecfa3d6e2eebaa180a702d6e6cc

Contents?: true

Size: 833 Bytes

Versions: 3

Compression:

Stored size: 833 Bytes

Contents

require 'slim'

Slim::Engine.default_options[:generator] = Temple::Generators::RailsOutputBuffer

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 self.call(template)
          Slim::Engine.new.compile(template.source)
        end
      end
    end
  end

  Template.register_default_template_handler :slim, TemplateHandlers::SlimHandler
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slim-0.8.1 lib/slim/rails.rb
slim-0.8.0 lib/slim/rails.rb
slim-0.7.4 lib/slim/rails.rb