Jldrill Git C0 Coverage Information - RCov

lib/jldrill/model/items/edict/Usage.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/jldrill/model/items/edict/Usage.rb 57 44
100.00%
100.00%

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 "jldrill/model/items/edict/Definition"
2 
3 module JLDrill
4     
5     # Holds a collection of definitions that defines a typical usage
6     # for the word.  It also holds an index number for the usage.
7     class Usage
8 
9     	attr_reader :index, :types, :definitions
10     	attr_writer :index
11 
12     	def initialize
13     		@definitions = []
14     		@index = 0
15     	end
16     	
17     	def Usage.create(string, index=0)
18     	    usage = Usage.new
19     	    usage.index = index
20     	    usage.parse(string)
21     	    usage
22     	end
23     	
24     	def parse(string)
25     		string.split("/").each do |definition|
26     			defn = Definition.create(definition)
27     			@definitions.push(defn)
28     		end
29     	end
30     	
31     	# Returns all the types in the definitions
32     	def allTypes
33     		retVal = []
34     		@definitions.each do |defn|
35     			retVal += defn.types
36     		end
37     		retVal
38     	end
39 
40          # Returns all the values for the definitions
41     	def allDefinitions
42     		retVal = []
43     		@definitions.each do |defn|
44     			retVal.push defn.value unless defn.value == ""
45     		end
46     		retVal
47     	end
48     	
49     	def to_s
50     	    retVal = ""
51     	    if index != 0
52     	        retVal += "(" + index.to_s + ")"
53     	    end
54     	    retVal += @definitions.join("/")
55     	end
56     end
57 end

Generated on Mon May 23 16:17:46 +0900 2011 with rcov 0.9.8