require "#{File.dirname(__FILE__)}/abstract_note" module Footnotes module Notes class AssignsNote < AbstractNote def initialize(controller) @assigns = controller.send(:view_assigns) end def title "Assigns (#{assign_keys.size})" end def valid? assign_keys.any? end def content rows = [] assign_keys.each do |key| rows << [ key, escape(@assigns[key].inspect) ] end mount_table(rows.unshift(['Name', 'Value']), :class => 'name_values', :summary => "Debug information for #{title}") end protected def assign_keys @assign_keys ||= (@assigns.keys.reject{|k| k[0] == ?_ } - ignored_assigns) end def ignored_assigns [ "action_has_layout", "lookup_context", "view_context_class" ] end end end end