Rcov C0 Coverage Information - RCov

app/models/image_annotation.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
app/models/image_annotation.rb 35 18
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 class ImageAnnotation < Annotation
2 
3 
4   #(x1, y1) is the top left corner and (x2, y2) is the bottom right corner
5   #of the rectangle containing the annotation.
6   validates_presence_of :x1, :x2, :y1, :y2
7   validates_numericality_of :x1, :x2, :y1, :y2
8 
9   # Return a hash containing the coordinates of the rectangle containing the
10   # annotation.
11   #
12   # ===Returns:
13   #
14   # A hash with keys id, x1, y1, x2, y2 where (x1, y1) is the top left corner
15   # and (x2, y2) is the bottom right corner of the rectangle and id is the
16   # annotation_text_id instance.
17   def extract_coords
18     horiz_range = {:start => [x1, x2].min, :end => [x1, x2].max}
19     vert_range = {:start => [y1, y2].min, :end => [y1, y2].max}
20     return {:id => annotation_text_id, :x_range => horiz_range, :y_range => vert_range}
21   end
22 
23   def add_annotation_js_string
24     return "add_to_annotation_grid('#{self.extract_coords.to_json()}')"
25   end
26 
27   def remove_annotation_js_string
28     return "remove_annotation(null, null, #{self.annotation_text.id});"
29   end
30 
31   def annotation_list_link_partial
32     return "/annotations/image_annotation_list_link"
33   end
34 
35 end

Generated on Tue Feb 07 00:07:36 -0500 2012 with rcov 0.9.10