Class: Piggly::Tags::ConditionalBranchTag
- Inherits:
-
AbstractTag
- Object
- AbstractTag
- Piggly::Tags::ConditionalBranchTag
- Defined in:
- lib/piggly/tags.rb
Overview
Tracks if, catch, case branch, continue when, and exit when statements where the coverage consists of the condition evaluating true and false
Constant Summary
Constants inherited from AbstractTag
Instance Attribute Summary collapse
-
#false ⇒ Object
readonly
Returns the value of attribute false.
-
#true ⇒ Object
readonly
Returns the value of attribute true.
Attributes inherited from AbstractTag
Instance Method Summary collapse
- #==(other) ⇒ Object
- #clear ⇒ Object
- #complete? ⇒ Boolean
- #description ⇒ Object
-
#initialize(*args) ⇒ ConditionalBranchTag
constructor
A new instance of ConditionalBranchTag.
- #ping(value) ⇒ Object
- #style ⇒ Object
- #to_f ⇒ Object
- #type ⇒ Object
Methods inherited from AbstractTag
Constructor Details
#initialize(*args) ⇒ ConditionalBranchTag
Returns a new instance of ConditionalBranchTag.
96 97 98 99 |
# File 'lib/piggly/tags.rb', line 96 def initialize(*args) clear super end |
Instance Attribute Details
#false ⇒ Object (readonly)
Returns the value of attribute false.
94 95 96 |
# File 'lib/piggly/tags.rb', line 94 def false @false end |
#true ⇒ Object (readonly)
Returns the value of attribute true.
94 95 96 |
# File 'lib/piggly/tags.rb', line 94 def true @true end |
Instance Method Details
#==(other) ⇒ Object
140 141 142 |
# File 'lib/piggly/tags.rb', line 140 def ==(other) @id == other.id and @true == other.true and @false == other.false end |
#clear ⇒ Object
136 137 138 |
# File 'lib/piggly/tags.rb', line 136 def clear @true, @false = false end |
#complete? ⇒ Boolean
120 121 122 |
# File 'lib/piggly/tags.rb', line 120 def complete? @true and @false end |
#description ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/piggly/tags.rb', line 124 def description if @true and @false "full coverage" elsif @true "never evaluates false" elsif @false "never evaluates true" else "never evaluated" end end |
#ping(value) ⇒ Object
105 106 107 108 109 110 |
# File 'lib/piggly/tags.rb', line 105 def ping(value) case value when "t"; @true = true when "f"; @false = true end end |
#style ⇒ Object
112 113 114 |
# File 'lib/piggly/tags.rb', line 112 def style "b#{@true ? 1 : 0}#{@false ? 1 : 0 }" end |
#to_f ⇒ Object
116 117 118 |
# File 'lib/piggly/tags.rb', line 116 def to_f (@true and @false) ? 100.0 : (@true or @false) ? 50.0 : 0.0 end |
#type ⇒ Object
101 102 103 |
# File 'lib/piggly/tags.rb', line 101 def type :branch end |