Class: ActionView::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/erector/rails2/template_handlers/rb_handler.rb

Instance Method Summary collapse

Instance Method Details

#instance_variables_for_widget_assignmentObject


2
3
4
# File 'lib/erector/rails2/template_handlers/rb_handler.rb', line 2

def instance_variables_for_widget_assignment
  instance_variables_for_widget_assignment_for(controller)
end

#instance_variables_for_widget_assignment_for(target) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/erector/rails2/template_handlers/rb_handler.rb', line 6

def instance_variables_for_widget_assignment_for(target)
  assigns = { }
  variables = target.instance_variable_names
  variables -= target.protected_instance_variables if target.respond_to?(:protected_instance_variables)
  variables -= %w{@real_format @request @template @_request}
  variables.each do |name|
    assign = name.sub('@', '').to_sym
    assigns[assign] = target.instance_variable_get(name)
  end
  assigns
end