Class: Rack::Insight::SpeedTracer::ServerEvent

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

Instance Attribute Summary collapse

Attributes inherited from TraceRecord

#children, #start

Instance Method Summary collapse

Methods inherited from TraceRecord

#duration, #finish, #time_in_children, #to_json

Methods included from Render

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

Methods included from Logging

logger, verbose, verbosity

Constructor Details

#initialize(method_call, arguments) ⇒ ServerEvent

Returns a new instance of ServerEvent.



135
136
137
138
139
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 135

def initialize(method_call, arguments)
  super()
  @arguments = arguments
  @name = "#{method_call.context}#{method_call.kind == :instance ? "#" : "::"}#{method_call.method}(#{arguments})"
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



133
134
135
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 133

def name
  @name
end

Instance Method Details

#hash_representationObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 141

def hash_representation
  {
    'range' => range(@start, @finish),
    'operation' =>  {
    #          'sourceCodeLocation' =>  {
    #          'className'   =>  @file,
    #          'methodName'  =>  @method,
    #          'lineNumber'  =>  @line
    #        },
    'type' =>  'METHOD',
    'label' =>  @name
  },
    'children' =>  @children
  }
end

#to_htmlObject



157
158
159
160
# File 'lib/rack/insight/panels/speedtracer_panel/tracer.rb', line 157

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