Class: Footnotes::Notes::SessionNote

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

Instance Method Summary collapse

Methods inherited from AbstractNote

close!, #has_fieldset?, included?, #javascript, #legend, #link, #onclick, #row, start!, #stylesheet, title, #to_sym, to_sym, #valid?

Constructor Details

#initialize(controller) ⇒ SessionNote

Returns a new instance of SessionNote.



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

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



24
25
26
# File 'lib/sinatra-footnotes/notes/session_note.rb', line 24

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

#titleObject



20
21
22
# File 'lib/sinatra-footnotes/notes/session_note.rb', line 20

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