Class: Footnotes::Notes::SessionNote

Inherits:
AbstractNote show all
Defined in:
lib/rails-footnotes/notes/session_note.rb

Instance Method Summary collapse

Methods inherited from AbstractNote

close!, #escape, #has_fieldset?, #hash_to_xml_attributes, included?, #javascript, #legend, #link, #mount_table, #mount_table_for_hash, #onclick, #prefix?, #row, start!, #stylesheet, title, #to_sym, to_sym, #valid?

Constructor Details

#initialize(controller) ⇒ SessionNote

Returns a new instance of SessionNote.



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rails-footnotes/notes/session_note.rb', line 4

def initialize(controller)
  session = controller.session
  if session
    if session.respond_to? :to_hash
      # rails >= 2.3
      session = session.to_hash
    else
      #rails < 2.3
      session = session.data
    end
  end
  @session = (session || {}).symbolize_keys
end

Instance Method Details

#contentObject



22
23
24
# File 'lib/rails-footnotes/notes/session_note.rb', line 22

def content
  mount_table_for_hash(@session, :summary => "Debug information for #{title}")
end

#titleObject



18
19
20
# File 'lib/rails-footnotes/notes/session_note.rb', line 18

def title
  "Session (#{@session.length})"
end