Module: Sinatra::Footnotes
- Defined in:
- lib/sinatra-footnotes.rb,
lib/sinatra-footnotes/version.rb
Defined Under Namespace
Modules: Helpers
Constant Summary collapse
- VERSION =
"0.1.5"
Class Method Summary collapse
Class Method Details
.registered(app) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/sinatra-footnotes.rb', line 57 def self.registered(app) app.helpers Footnotes::Helpers app.after do style_path = File.join( File.dirname(__FILE__), 'sinatra-footnotes', 'style.html') if response.body.respond_to? :push response.body.push File.read(style_path) response.body.push '<!-- Footnotes -->' response.body.push '<div style="clear:both"></div>' response.body.push '<div id="footnotes_debug">' response.body.push 'Show:' notes = [] notes.push ::Footnotes::Notes::SessionNote.new(self) notes.push ::Footnotes::Notes::FlashNote.new(self) notes.push ::Footnotes::Notes::CookiesNote.new(self.request) notes.push ::Footnotes::Notes::ParamsNote.new(self) notes.push ::Footnotes::Notes::SinatraRoutesNote.new(app) notes.push ::Footnotes::Notes::EnvNote.new(self) notes.push(::Footnotes::Notes::AssignsNote.new(self).tap do |note| note.ignored_assigns = [:@default_layout, :@app, :@template_cache, :@env, :@request, :@response, :@params, :@preferred_extension, :@_out_buf, :@_routes] end) response.body.push notes.map { |note| link_helper(note) }.join(' | ') response.body.push '<br />' response.body.push fieldsets(notes) script_path = File.join( File.dirname(__FILE__), 'sinatra-footnotes', 'script.html') response.body.push(File.read(script_path)) response.body.push '</div>' response.body.push '<!-- End Footnotes -->' end end end |