Class: Footnotes::Notes::RsolrRequestsNote
- Inherits:
-
AbstractNote
- Object
- AbstractNote
- Footnotes::Notes::RsolrRequestsNote
- Defined in:
- lib/notes/rsolr_requests_note.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.query_subscriber ⇒ Object
3 4 5 |
# File 'lib/notes/rsolr_requests_note.rb', line 3 def self.query_subscriber @@query_subscriber ||= RsolrSubscriber.new end |
.start!(controller) ⇒ Object
7 8 9 |
# File 'lib/notes/rsolr_requests_note.rb', line 7 def self.start!(controller) self.query_subscriber.reset! end |
.title ⇒ Object
15 16 17 |
# File 'lib/notes/rsolr_requests_note.rb', line 15 def self.title "Solr Requests" end |
Instance Method Details
#content ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/notes/rsolr_requests_note.rb', line 27 def content html = '' events.each_with_index do |event, index| html << <<-HTML <div class="rsolr_response_note"> <b>#{event.method.to_s.upcase} #{event.path}</b> (<a href="#{ event.uri.to_s }">[link]</a>) <span>(#{ event.duration } ms)</span><br /> <span><b>params:</b> #{ event.params.inspect }</span><br /> <span><b>header:</b> #{ event.response["responseHeader"].inspect }</span><br /> <a href=\"javascript:Footnotes.toggle('rsolr_response_#{index}')\" style=\"color:#00A;\">toggle response</a> <p class="response" id="rsolr_response_#{index}" style="display:none;">#{ event.response.inspect }</p> </div> HTML end html end |
#events ⇒ Object
11 12 13 |
# File 'lib/notes/rsolr_requests_note.rb', line 11 def events self.class.query_subscriber.events end |
#stylesheet ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/notes/rsolr_requests_note.rb', line 19 def stylesheet <<-CSS .rsolr_response_note { margin-bottom: 1em } .rsolr_response_note .response { padding-left: 50px; color: #777; } CSS end |