Jldrill Git C0 Coverage Information - RCov

lib/jldrill/model/items/Field.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/jldrill/model/items/Field.rb 66 48
96.97%
95.83%

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 # Represents a Field in a Vocabulary
2 # This is an abstract class.  The concrete class must implement:
3 #
4 #     fromString() -- Returns contents from a string without input processing
5 #     contents() -- Returns the contents of the field unaltered
6 #     raw()      -- Returns a string of the contents unaltered
7 #     copy()     -- Copies the contents from a field if it is assigned
8 #     eql?()     -- Returns true if the contents are eql? to the passed contents
9 
10 
11 module JLDrill
12     class Field
13 
14         QUOTE_RE = /["]/
15         RETURN_RE = /[\n]/
16         SLASH_RE = /[\/]/
17         ESCAPED_COMMA_RE = Regexp.new("\\,", nil, "U")
18         ESCAPED_SLASH_RE = Regexp.new("\\/", nil, "U")
19 
20         def initialize(name)
21             @name = name
22         end
23 
24         def processInput(text)
25             if text.nil? || text.empty?
26                 return nil
27             end
28             text = text.gsub(RETURN_RE, "\\n")
29             text
30         end
31 
32         def processOutput(text)
33             if text.nil?
34                 return nil
35             end
36             text = text.gsub(ESCAPED_COMMA_RE, ",")
37             text = text.gsub(ESCAPED_SLASH_RE, "/")
38             eval("\"#{text.gsub(QUOTE_RE, "\\\"")}\"")
39         end
40 
41         def assign(string)
42             string = processInput(string)
43             fromString(string)
44         end
45 
46         def assigned?
47             !contents().nil? && !contents.empty?
48         end
49 
50         def output
51             if assigned?
52                 processOutput(raw())
53             else
54                 nil
55             end
56         end
57 
58         def to_s
59             if assigned?
60                 "/#{@name}: " + raw()
61             else
62                 ""
63             end
64         end
65     end
66 end

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