Class: RuboCop::Cop::RSpecParity::SufficientContexts::Branch
- Inherits:
-
Struct
- Object
- Struct
- RuboCop::Cop::RSpecParity::SufficientContexts::Branch
- Defined in:
- lib/rubocop/cop/rspec_parity/sufficient_contexts.rb
Overview
A single counted branch. kind is :guard or :regular (preserving the
guard fall-through accounting in #branches_from). label is the
normalized condition/operator source used both for display and for
matching # rspec_parity:covers annotations. origin is nil for the
method's own branches, or the helper method name when inlined from a
single-use private method. detail is an optional semantic qualifier
(e.g. "b decides", "assigns") applied only when the plain label collides
with another branch — see #disambiguate.
Instance Attribute Summary collapse
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#label ⇒ Object
Returns the value of attribute label.
-
#line ⇒ Object
Returns the value of attribute line.
-
#origin ⇒ Object
Returns the value of attribute origin.
Instance Method Summary collapse
-
#annotation_token ⇒ Object
The string an author types after
# rspec_parity:coversto claim this branch.
Instance Attribute Details
#detail ⇒ Object
Returns the value of attribute detail
217 218 219 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 217 def detail @detail end |
#kind ⇒ Object
Returns the value of attribute kind
217 218 219 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 217 def kind @kind end |
#label ⇒ Object
Returns the value of attribute label
217 218 219 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 217 def label @label end |
#line ⇒ Object
Returns the value of attribute line
217 218 219 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 217 def line @line end |
#origin ⇒ Object
Returns the value of attribute origin
217 218 219 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 217 def origin @origin end |
Instance Method Details
#annotation_token ⇒ Object
The string an author types after # rspec_parity:covers to claim this
branch. The origin prefix disambiguates identical conditions in
different helpers; it is optional when the condition is unique.
221 222 223 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 221 def annotation_token origin ? "#{origin}: #{label}" : label end |