Class: Rack::Bug::SpeedTrace::ServerEvent

Inherits:
TraceRecord
  • Object
show all
Defined in:
lib/rack/bug/panels/speedtracer_panel/tracer.rb

Instance Attribute Summary collapse

Attributes inherited from TraceRecord

#start

Instance Method Summary collapse

Methods inherited from TraceRecord

#duration, #finish, #time_in_children, #to_json

Methods included from Render

#compiled_source

Methods included from Render

#compile, #compile!, #compiled_source, #method_name, #method_name_without_locals, #render_template, #signed_params

Constructor Details

#initialize(id, file, line, method, context, arguments) ⇒ ServerEvent

Returns a new instance of ServerEvent.



55
56
57
58
59
60
61
62
63
64
# File 'lib/rack/bug/panels/speedtracer_panel/tracer.rb', line 55

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

#childrenObject

Returns the value of attribute children.



52
53
54
# File 'lib/rack/bug/panels/speedtracer_panel/tracer.rb', line 52

def children
  @children
end

#nameObject (readonly)

Returns the value of attribute name.



53
54
55
# File 'lib/rack/bug/panels/speedtracer_panel/tracer.rb', line 53

def name
  @name
end

Instance Method Details

#hash_representationObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/rack/bug/panels/speedtracer_panel/tracer.rb', line 66

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_htmlObject



83
84
85
86
# File 'lib/rack/bug/panels/speedtracer_panel/tracer.rb', line 83

def to_html
  render_template('panels/speedtracer/serverevent', 
                  {:self_time => duration - time_in_children}.merge(symbolize_hash(hash_representation)))
end