Class: Rack::Insight::CachePanel::Stats::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/insight/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.



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

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.



6
7
8
# File 'lib/rack/insight/panels/cache_panel/stats.rb', line 6

def hit
  @hit
end

#keysObject (readonly)

Returns the value of attribute keys.



6
7
8
# File 'lib/rack/insight/panels/cache_panel/stats.rb', line 6

def keys
  @keys
end

#methodObject (readonly)

Returns the value of attribute method.



6
7
8
# File 'lib/rack/insight/panels/cache_panel/stats.rb', line 6

def method
  @method
end

#timeObject (readonly)

Returns the value of attribute time.



6
7
8
# File 'lib/rack/insight/panels/cache_panel/stats.rb', line 6

def time
  @time
end

Instance Method Details

#display_keysObject



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

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

#display_timeObject



15
16
17
# File 'lib/rack/insight/panels/cache_panel/stats.rb', line 15

def display_time
  "%.2fms" % time
end