Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/asir/coder.rb | 64 | 34 | 84.38%
|
70.59%
|
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.
1 module ASIR |
2 # !SLIDE |
3 # Coder |
4 # |
5 # Define encoding and decoding for Requests and Responses along a Transport. |
6 class Coder |
7 include Log, Initialization |
8 |
9 def encode obj |
10 _encode obj |
11 end |
12 |
13 def decode obj |
14 obj and _decode obj |
15 end |
16 |
17 def _subclass_responsibility *args |
18 raise "subclass responsibility" |
19 end |
20 alias :_encode :_subclass_responsibility |
21 alias :_decode :_subclass_responsibility |
22 |
23 |
24 # Coder subclasses. |
25 # ... |
26 # !SLIDE pause |
27 |
28 # !SLIDE |
29 # Null Coder |
30 # Always encode/decode as nil. |
31 class Null < self |
32 def _encode obj |
33 nil |
34 end |
35 |
36 def _decode obj |
37 nil |
38 end |
39 |
40 # Completely stateless. |
41 def dup; self; end |
42 end |
43 |
44 |
45 # !SLIDE |
46 # Identity Coder |
47 # Perform no encode/decode. |
48 class Identity < self |
49 def _encode obj |
50 obj |
51 end |
52 |
53 def _decode obj |
54 obj |
55 end |
56 |
57 # Completely stateless. |
58 def dup; self; end |
59 end |
60 # !SLIDE resume |
61 end |
62 # !SLIDE END |
63 end |
64 |
Generated on Fri Jan 27 17:37:46 -0600 2012 with rcov 0.9.8