Class: Nitpick::Warnings::IdenticalBranch
- Inherits:
-
SimpleWarning
- Object
- SimpleWarning
- Nitpick::Warnings::IdenticalBranch
- Defined in:
- lib/nitpick/warnings/identical_branch.rb
Instance Attribute Summary collapse
-
#no_branch ⇒ Object
readonly
Returns the value of attribute no_branch.
-
#yes_branch ⇒ Object
readonly
Returns the value of attribute yes_branch.
Instance Method Summary collapse
-
#initialize(*args) ⇒ IdenticalBranch
constructor
A new instance of IdenticalBranch.
- #matches? ⇒ Boolean
- #message ⇒ Object
Methods inherited from SimpleWarning
Constructor Details
#initialize(*args) ⇒ IdenticalBranch
Returns a new instance of IdenticalBranch.
5 6 7 |
# File 'lib/nitpick/warnings/identical_branch.rb', line 5 def initialize(*args) @cond, @yes_branch, @no_branch = args end |
Instance Attribute Details
#no_branch ⇒ Object (readonly)
Returns the value of attribute no_branch.
4 5 6 |
# File 'lib/nitpick/warnings/identical_branch.rb', line 4 def no_branch @no_branch end |
#yes_branch ⇒ Object (readonly)
Returns the value of attribute yes_branch.
4 5 6 |
# File 'lib/nitpick/warnings/identical_branch.rb', line 4 def yes_branch @yes_branch end |
Instance Method Details
#matches? ⇒ Boolean
9 10 11 |
# File 'lib/nitpick/warnings/identical_branch.rb', line 9 def matches? yes_branch == no_branch end |
#message ⇒ Object
13 14 15 |
# File 'lib/nitpick/warnings/identical_branch.rb', line 13 def "The branches of 'if (#{sexp_to_ruby(@cond)})' are identical." end |