Module: OyenCov::ControllerTracking

Defined in:
lib/oyencov/controller_tracking.rb

Constant Summary collapse

@@hits =
{}

Class Method Summary collapse

Class Method Details

.bump(controller_action_name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/oyencov/controller_tracking.rb', line 14

def self.bump(controller_action_name)
  if @@hits[controller_action_name]
    @@hits[controller_action_name] += 1
  else
    @@hits[controller_action_name] = 1
  end

  OyenCov::Logger.log "ControllerTracking.bump self.object_id = #{object_id}"
  OyenCov::Logger.log "ControllerTracking.bump @@hits[#{controller_action_name}] = #{@@hits[controller_action_name]}"
end

.hitsObject



10
11
12
# File 'lib/oyencov/controller_tracking.rb', line 10

def self.hits
  @@hits
end

.snapshot_and_reset!Object



25
26
27
28
29
30
31
32
# File 'lib/oyencov/controller_tracking.rb', line 25

def self.snapshot_and_reset!
  OyenCov::Logger.log "ControllerTracking.snapshot_and_reset! self.object_id = #{object_id}"
  OyenCov::Logger.log "ControllerTracking.snapshot_and_reset! @@hits = #{@@hits}"

  current_hits = @@hits.dup
  @@hits = {}
  current_hits
end