Class: Hashira::Complexity::MethodFinding
- Inherits:
-
Object
- Object
- Hashira::Complexity::MethodFinding
- Defined in:
- lib/hashira/complexity/method_finding.rb
Constant Summary collapse
- ADVICE =
{ "if" => "flatten the branching — guard clauses, early returns, or polymorphism.", "elsif" => "replace the elsif ladder with a lookup or polymorphic dispatch.", "else" => "flatten the branching — guard clauses, early returns, or polymorphism.", "case" => "a case this size often wants polymorphism or a dispatch table.", "boolean" => "name the compound condition in a predicate method.", "rescue" => "narrow the rescue, or lift error handling to the caller.", "while" => "extract the loop body into its own method.", "until" => "extract the loop body into its own method.", "for" => "extract the loop body into its own method.", "unless" => "invert to a guard clause or a named predicate.", "ternary" => "extract the nested ternary into a named method." }.freeze
Instance Method Summary collapse
-
#initialize(score) ⇒ MethodFinding
constructor
A new instance of MethodFinding.
- #to_finding ⇒ Object
Constructor Details
#initialize(score) ⇒ MethodFinding
Returns a new instance of MethodFinding.
20 21 22 |
# File 'lib/hashira/complexity/method_finding.rb', line 20 def initialize(score) @score = score end |