Sha256: ce6896cab0848b5f086efe433f5cd0627025ad2d1f9ce190b85d6216030708cb

Contents?: true

Size: 814 Bytes

Versions: 19

Compression:

Stored size: 814 Bytes

Contents

require 'safemode'
require 'haml/safemode'

module ActionView
  module TemplateHandlers
    class SafeHaml < TemplateHandler
      include Compilable rescue nil # does not exist prior Rails 2.1
      extend SafemodeHandler
      
      def self.line_offset
      3
      end

      def compile(template)
        # Rails 2.0 passes the template source, while Rails 2.1 passes the
        # template instance
        src = template.respond_to?(:source) ? template.source : template
        filename = template.filename rescue nil

        options = Haml::Template.options.dup
        haml = Haml::Engine.new template, options
        methods = delegate_methods + ActionController::Routing::Routes.named_routes.helpers
        haml.precompile_for_safemode filename, ignore_assigns, methods
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
safemode-1.3.8 lib/action_view/template_handlers/safe_haml.rb
safemode-1.3.7 lib/action_view/template_handlers/safe_haml.rb
safemode-1.3.6 lib/action_view/template_handlers/safe_haml.rb
safemode-1.3.5 lib/action_view/template_handlers/safe_haml.rb
safemode-1.3.4 lib/action_view/template_handlers/safe_haml.rb
safemode-1.3.3 lib/action_view/template_handlers/safe_haml.rb
safemode-1.3.2 lib/action_view/template_handlers/safe_haml.rb
safemode-1.3.1 lib/action_view/template_handlers/safe_haml.rb
safemode-1.2.5 lib/action_view/template_handlers/safe_haml.rb
safemode-1.2.4 lib/action_view/template_handlers/safe_haml.rb
safemode-1.2.3 lib/action_view/template_handlers/safe_haml.rb
safemode-1.2.2 lib/action_view/template_handlers/safe_haml.rb
safemode-1.2.1 lib/action_view/template_handlers/safe_haml.rb
safemode-1.0.2 lib/action_view/template_handlers/safe_haml.rb
safemode-1.2.0 lib/action_view/template_handlers/safe_haml.rb
safemode-1.1.0 lib/action_view/template_handlers/safe_haml.rb
safemode-1.0.1 lib/action_view/template_handlers/safe_haml.rb
safemode-1.0.0 lib/action_view/template_handlers/safe_haml.rb
safemode-0.0.2 lib/action_view/template_handlers/safe_haml.rb