Class: Rack::Insight::ActiveResourcePanel::RequestResult

Inherits:
Object
  • Object
show all
Includes:
FilteredBacktrace
Defined in:
lib/rack/insight/panels/active_resource_panel/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FilteredBacktrace

#backtrace, backtrace_regexp, #filtered_backtrace, #has_backtrace?, root_for_backtrace_filtering

Constructor Details

#initialize(path, args, time, backtrace = [], result = nil) ⇒ RequestResult

Returns a new instance of RequestResult.



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

def initialize(path, args, time, backtrace = [], result=nil)
  @path = path
  @args = args
  @time = time
  @backtrace = backtrace
  @result = result
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



6
7
8
# File 'lib/rack/insight/panels/active_resource_panel/query.rb', line 6

def args
  @args
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/rack/insight/panels/active_resource_panel/query.rb', line 6

def path
  @path
end

#resultObject (readonly) Also known as: results

Returns the value of attribute result.



6
7
8
# File 'lib/rack/insight/panels/active_resource_panel/query.rb', line 6

def result
  @result
end

#timeObject (readonly)

Returns the value of attribute time.



6
7
8
# File 'lib/rack/insight/panels/active_resource_panel/query.rb', line 6

def time
  @time
end

Instance Method Details

#human_timeObject



17
18
19
# File 'lib/rack/insight/panels/active_resource_panel/query.rb', line 17

def human_time
  "%.2fms" % (@time)
end

#valid_hash?(secret_key, possible_hash) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/rack/insight/panels/active_resource_panel/query.rb', line 21

def valid_hash?(secret_key, possible_hash)
  hash = Digest::SHA1.hexdigest [secret_key, @sql].join(":")
  possible_hash == hash
end