Module: LRD::DebugHelper
- Defined in:
- lib/app/helpers/lrd_debug_helper.rb
Instance Method Summary collapse
- #debug_block(name, &block) ⇒ Object
- #debug_link(name) ⇒ Object
- #lrd_debug(object) ⇒ Object
- #pp_s(*objs) ⇒ Object (also: #pp_to_s)
Instance Method Details
#debug_block(name, &block) ⇒ Object
23 24 25 26 27 |
# File 'lib/app/helpers/lrd_debug_helper.rb', line 23 def debug_block(name, &block) content = capture(&block) title = content_tag(:h2, name.titleize) concat(content_tag :fieldset, content, {:id => "#{name}_debug_info", :style => 'display: none;' } ) end |
#debug_link(name) ⇒ Object
20 21 22 |
# File 'lib/app/helpers/lrd_debug_helper.rb', line 20 def debug_link(name) link_to name.titleize, '#', :onclick => "Element.toggle('#{name}_debug_info'); return false;" end |
#lrd_debug(object) ⇒ Object
6 7 8 |
# File 'lib/app/helpers/lrd_debug_helper.rb', line 6 def lrd_debug(object) "<pre>#{h(pp_s(object))}</pre>" end |
#pp_s(*objs) ⇒ Object Also known as: pp_to_s
10 11 12 13 14 15 16 17 |
# File 'lib/app/helpers/lrd_debug_helper.rb', line 10 def pp_s(*objs) s = StringIO.new objs.each {|obj| PP.pp(obj, s) } s.rewind s.read end |