Class: ActionView::TemplateHandlers::SafeHaml

Inherits:
TemplateHandler
  • Object
show all
Extended by:
SafemodeHandler
Defined in:
lib/action_view/template_handlers/safe_haml.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SafemodeHandler

delegate_methods, helper_methods, skip_assigns, valid_assigns

Class Method Details

.line_offsetObject



10
11
12
# File 'lib/action_view/template_handlers/safe_haml.rb', line 10

def self.line_offset
3
end

Instance Method Details

#compile(template) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/action_view/template_handlers/safe_haml.rb', line 14

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