Class: Rack::Bug::SpeedTrace::ServerEvent
- Inherits:
-
TraceRecord
- Object
- TraceRecord
- Rack::Bug::SpeedTrace::ServerEvent
- Defined in:
- lib/rack/bug/speedtracer/tracer.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #hash_representation ⇒ Object
-
#initialize(id, file, line, method, context, arguments) ⇒ ServerEvent
constructor
A new instance of ServerEvent.
- #to_html ⇒ Object
Methods inherited from TraceRecord
#duration, #finish, #time_in_children, #to_json
Methods included from Render
Constructor Details
#initialize(id, file, line, method, context, arguments) ⇒ ServerEvent
Returns a new instance of ServerEvent.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rack/bug/speedtracer/tracer.rb', line 53 def initialize(id, file, line, method, context, arguments) super(id) @file = file @line = line @method = method @context = context @arguments = arguments @name = [context, method, "(", arguments, ")"].join("") end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
50 51 52 |
# File 'lib/rack/bug/speedtracer/tracer.rb', line 50 def children @children end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
51 52 53 |
# File 'lib/rack/bug/speedtracer/tracer.rb', line 51 def name @name end |
Instance Method Details
#hash_representation ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/rack/bug/speedtracer/tracer.rb', line 64 def hash_representation { 'range' => range(@start, @finish), #'id' => @id, 'operation' => { # 'sourceCodeLocation' => { # 'className' => @file, # 'methodName' => @method, # 'lineNumber' => @line # }, 'type' => 'METHOD', 'label' => @name }, 'children' => @children } end |
#to_html ⇒ Object
81 82 83 84 |
# File 'lib/rack/bug/speedtracer/tracer.rb', line 81 def to_html render_template('serverevent', {:self_time => duration - time_in_children}.merge(symbolize_hash(hash_representation))) end |