Class: MetzScan::Analyzers::RepeatedBranching::DecisionSubject
- Inherits:
-
Object
- Object
- MetzScan::Analyzers::RepeatedBranching::DecisionSubject
- Defined in:
- lib/metz_scan/analyzers/repeated_branching/decision_subject.rb
Instance Attribute Summary collapse
-
#decision ⇒ Object
readonly
Returns the value of attribute decision.
Class Method Summary collapse
Instance Method Summary collapse
- #generic? ⇒ Boolean
-
#initialize(decision) ⇒ DecisionSubject
constructor
A new instance of DecisionSubject.
- #kind ⇒ Object
- #label ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(decision) ⇒ DecisionSubject
Returns a new instance of DecisionSubject.
15 16 17 |
# File 'lib/metz_scan/analyzers/repeated_branching/decision_subject.rb', line 15 def initialize(decision) @decision = decision end |
Instance Attribute Details
#decision ⇒ Object (readonly)
Returns the value of attribute decision.
19 20 21 |
# File 'lib/metz_scan/analyzers/repeated_branching/decision_subject.rb', line 19 def decision @decision end |
Class Method Details
.for(decision) ⇒ Object
11 12 13 |
# File 'lib/metz_scan/analyzers/repeated_branching/decision_subject.rb', line 11 def self.for(decision) new(decision) end |
Instance Method Details
#generic? ⇒ Boolean
21 22 23 |
# File 'lib/metz_scan/analyzers/repeated_branching/decision_subject.rb', line 21 def generic? kind == "generic" end |
#kind ⇒ Object
25 26 27 28 29 30 |
# File 'lib/metz_scan/analyzers/repeated_branching/decision_subject.rb', line 25 def kind return "generic" if GENERIC_SUBJECTS.include?(decision) return "state" if SIMPLE_IDENTIFIER.match?(decision) "expression" end |
#label ⇒ Object
32 33 34 35 36 |
# File 'lib/metz_scan/analyzers/repeated_branching/decision_subject.rb', line 32 def label { "generic" => "generic branch subject", "state" => "state branch subject", "expression" => "expression subject" }.fetch(kind) end |
#summary ⇒ Object
38 39 40 41 42 |
# File 'lib/metz_scan/analyzers/repeated_branching/decision_subject.rb', line 38 def summary { "generic" => "Generic subject; use reported contexts before treating this as design pressure.", "state" => "State-like subject; repeated branch tables may describe a shared domain decision.", "expression" => "Expression subject; repeated computed conditions may deserve extraction." }.fetch(kind) end |