Abstracting Services In Ruby C0 Coverage Information - RCov

lib/asir/request_identity.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/asir/request_identity.rb 36 24
61.11%
41.67%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 require 'asir/uuid'
2 require 'thread' # Mutex
3 
4 module ASIR
5   # !SLIDE
6   # Request Identity
7   #
8   module RequestIdentity
9     attr_accessor :identifier, :timestamp
10 
11     # Optional: Opaque data about the Client that created the Request.
12     attr_accessor :client
13 
14     # Optional: Opaque data about the Service that handled the Response.
15     attr_accessor :server
16 
17     # Creates a thread-safe unique identifier.
18     def create_identifier!
19       @identifier ||= 
20         @@identifier_mutex.synchronize do
21           if @@uuid_pid != $$
22             @@uuid_pid = $$
23             @@uuid = nil
24           end
25           "#{@@counter += 1}-#{@@uuid ||= ::ASIR::UUID.generate}".freeze
26         end
27     end
28     @@counter ||= 0; @@uuid ||= nil; @@uuid_pid = nil; @@identifier_mutex ||= Mutex.new
29 
30     # Creates a timestamp.
31     def create_timestamp!
32       @timestamp ||= 
33         ::Time.now.gmtime
34     end
35   end
36 end

Generated on Fri Jan 27 17:37:46 -0600 2012 with rcov 0.9.8