Class: Rack::Bug::CachePanel::Stats::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/bug/panels/cache_panel/stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, time, hit, keys) ⇒ Query

Returns a new instance of Query.



9
10
11
12
13
14
# File 'lib/rack/bug/panels/cache_panel/stats.rb', line 9

def initialize(method, time, hit, keys)
  @method = method
  @time = time
  @hit = hit
  @keys = keys
end

Instance Attribute Details

#hitObject (readonly)

Returns the value of attribute hit.



7
8
9
# File 'lib/rack/bug/panels/cache_panel/stats.rb', line 7

def hit
  @hit
end

#keysObject (readonly)

Returns the value of attribute keys.



7
8
9
# File 'lib/rack/bug/panels/cache_panel/stats.rb', line 7

def keys
  @keys
end

#methodObject (readonly)

Returns the value of attribute method.



7
8
9
# File 'lib/rack/bug/panels/cache_panel/stats.rb', line 7

def method
  @method
end

#timeObject (readonly)

Returns the value of attribute time.



7
8
9
# File 'lib/rack/bug/panels/cache_panel/stats.rb', line 7

def time
  @time
end

Instance Method Details

#display_keysObject



20
21
22
23
24
25
26
# File 'lib/rack/bug/panels/cache_panel/stats.rb', line 20

def display_keys
  if keys.size == 1
    keys.first
  else
    keys.join(", ")
  end
end

#display_timeObject



16
17
18
# File 'lib/rack/bug/panels/cache_panel/stats.rb', line 16

def display_time
  "%.2fms" % time
end