Module: ActionView::TemplateHandlers::SafemodeHandler

Included in:
SafeErb, SafeHaml
Defined in:
lib/action_view/template_handlers/safemode_handler.rb

Instance Method Summary collapse

Instance Method Details

#delegate_methods(view) ⇒ Object



9
10
11
12
13
# File 'lib/action_view/template_handlers/safemode_handler.rb', line 9

def delegate_methods(view)
  [ :render, :params, :flash ] + 
  helper_methods(view) + 
  ActionController::Routing::Routes.named_routes.helpers
end

#helper_methods(view) ⇒ Object



15
16
17
# File 'lib/action_view/template_handlers/safemode_handler.rb', line 15

def helper_methods(view)
  view.class.included_modules.collect {|m| m.instance_methods(false) }.flatten.map(&:to_sym)
end

#skip_assignsObject



19
20
21
22
23
24
25
# File 'lib/action_view/template_handlers/safemode_handler.rb', line 19

def skip_assigns
  [ "_cookies", "_flash", "_headers", "_params", "_request",
    "_response", "_session", "before_filter_chain_aborted",
    "ignore_missing_templates", "logger", "request_origin",
    "template", "template_class", "url", "variables_added",
    "view_paths" ]        
end

#valid_assigns(assigns) ⇒ Object



5
6
7
# File 'lib/action_view/template_handlers/safemode_handler.rb', line 5

def valid_assigns(assigns)
  assigns = assigns.reject{|key, value| skip_assigns.include?(key) }
end