lib/rack/insight/panel.rb in rack-insight-0.5.19 vs lib/rack/insight/panel.rb in rack-insight-0.5.20
- old
+ new
@@ -145,13 +145,13 @@
if !has_table?
table_setup(self.name)
end
end
- #def inspect
- # "M:#{self.bool_prop(:is_magic?)} T:#{self.bool_prop(:has_table?)} P:#{self.bool_prop(:is_probing?)} C:#{self.bool_prop(:has_custom_probes?)} Name: #{name}"
- #end
+ def inspect
+ "#{self.underscored_name} Magic:#{self.bool_prop(:is_magic?)} Table:#{self.bool_prop(:has_table?)} Probe:#{self.bool_prop(:is_probing?)} Custom:#{self.bool_prop(:has_custom_probes?)}" rescue "XXX inspect failed"
+ end
def bool_prop(prop)
self.send(prop) ? 'Y' : 'N'
end
@@ -232,17 +232,25 @@
def heading_for_request(number)
if !self.has_table?
heading
else
num = count(number)
- if num == 0
- heading
+ if num.kind_of?(Numeric)
+ if num == 0
+ heading
+ else
+ "#{self.camelized_name} (#{num})"
+ end
else
- "#{self.camelized_name} (#{num})"
+ heading
end
end
- rescue 'XXX' # no panel should need this
+ rescue Object => ex
+ nom = self.name rescue "xxx"
+"Err3: #{nom}
+ Panel: #{self.inspect}
+ #{([ex.class.name, ex.message] + ex.backtrace).join("<br/>")}"
end
def content_for_request(number)
logger.info("Rack::Insight is using default content_for_request for #{self.class}") if verbose(:med)
if !self.has_table?
@@ -258,19 +266,33 @@
render_template 'no_data', :name => self.camelized_name
end
else
content
end
- rescue 'XXX' #XXX: no panel should need this
+ rescue Object => ex
+ nom = self.name rescue "xxx"
+"Err4: #{nom}
+ Panel: #{self.inspect}
+ #{([ex.class.name, ex.message] + ex.backtrace).join("<br/>")}"
end
def heading
self.camelized_name
+ rescue Object => ex
+ nom = self.name rescue "xxx"
+"Err1: #{nom}
+ Panel: #{self.inspect}
+ #{([ex.class.name, ex.message] + ex.backtrace).join("<br/>")}"
end
def content
logger.info("Rack::Insight is using default content for #{self.class}") if verbose(:med)
render_template 'no_content', :name => self.camelized_name
+ rescue Object => ex
+ nom = self.name rescue "xxx"
+"Err2: #{nom}
+ Panel: #{self.inspect}
+ #{([ex.class.name, ex.message] + ex.backtrace).join("<br/>")}"
end
# Override in subclasses.
# This is to make magic classes work.
def after_detect(method_call, timing, args, result)