lib/tracebin/events.rb in tracebin-0.0.9 vs lib/tracebin/events.rb in tracebin-0.0.10
- old
+ new
@@ -22,11 +22,11 @@
{
event_type: type,
start: event[1],
stop: event[2],
duration: to_milliseconds(event[2] - event[1]),
- data: event.last
+ data: select_data || event.last
}
end
end
class SQLEvent < Event
@@ -37,31 +37,60 @@
private
def type
:sql
end
+
+ def select_data
+ {
+ sql: event.last[:sql],
+ name: event.last[:name],
+ statement_name: event.last[:statement_name]
+ }
+ end
end
class ControllerEvent < Event
private
def type
:controller_action
end
+
+ def select_data
+ {
+ controller: event.last[:controller],
+ action: event.last[:action],
+ format: event.last[:format],
+ method: event.last[:method],
+ path: event.last[:path],
+ status: event.last[:status],
+ view_runtime: event.last[:view_runtime],
+ db_runtime: event.last[:db_runtime]
+ }
+ end
end
class ViewEvent < Event
private
def type
:view
end
+
+ def select_data
+ nil
+ end
end
class SinatraEvent < Event
private
def type
:route
+ end
+
+ def select_data
+ nil
end
end
end