Class: Rack::Insight::DefaultInvocation

Inherits:
Struct
  • Object
show all
Includes:
FilteredBacktrace, MagicInsight
Defined in:
lib/rack/insight/default_invocation.rb

Constant Summary

Constants included from MagicInsight

MagicInsight::ANCESTORS_FILTER, MagicInsight::IDIOMS, MagicInsight::SAFETY_REGEX_FILTER, MagicInsight::WARNING

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MagicInsight

#_dirty_ancestors, #_dirty_methods, #_filtered_ancestors, #_filtered_methods, #_has_idioms?, #_idiomatic_method, #_idiomatic_methods, #_magic_insight_methods, #_my_children, #_sorted_methods, included

Methods included from FilteredBacktrace

backtrace_regexp, #filtered_backtrace, #has_backtrace?, root_for_backtrace_filtering

Constructor Details

#initialize(*args) ⇒ DefaultInvocation

Returns a new instance of DefaultInvocation.



9
10
11
12
13
14
15
# File 'lib/rack/insight/default_invocation.rb', line 9

def initialize(*args)
  @method = args[0]
  @time = [args[1].duration, args[1].delta_t]
  @arguments = args[2]
  @result = args[3]
  @backtrace = args[4]
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments

Returns:

  • (Object)

    the current value of arguments



3
4
5
# File 'lib/rack/insight/default_invocation.rb', line 3

def arguments
  @arguments
end

#backtraceObject

Returns the value of attribute backtrace

Returns:

  • (Object)

    the current value of backtrace



3
4
5
# File 'lib/rack/insight/default_invocation.rb', line 3

def backtrace
  @backtrace
end

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



3
4
5
# File 'lib/rack/insight/default_invocation.rb', line 3

def method
  @method
end

#resultObject

Returns the value of attribute result

Returns:

  • (Object)

    the current value of result



3
4
5
# File 'lib/rack/insight/default_invocation.rb', line 3

def result
  @result
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



3
4
5
# File 'lib/rack/insight/default_invocation.rb', line 3

def time
  @time
end

Instance Method Details

#human_timeObject



17
18
19
# File 'lib/rack/insight/default_invocation.rb', line 17

def human_time
  "%.2fms" % (self.time * 1_000)
end