Class: Legion::CLI::Doctor::Result
- Inherits:
-
Object
- Object
- Legion::CLI::Doctor::Result
- Defined in:
- lib/legion/cli/doctor/result.rb
Constant Summary collapse
- SCORE_MAP =
{ pass: 1.0, warn: 0.5, fail: 0.0, skip: nil }.freeze
Instance Attribute Summary collapse
-
#auto_fixable ⇒ Object
readonly
Returns the value of attribute auto_fixable.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prescription ⇒ Object
readonly
Returns the value of attribute prescription.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
- #fail? ⇒ Boolean
-
#initialize(name:, status:, message: nil, prescription: nil, auto_fixable: false, weight: 1.0) ⇒ Result
constructor
rubocop:disable Metrics/ParameterLists.
- #pass? ⇒ Boolean
- #score ⇒ Object
- #skip? ⇒ Boolean
- #to_h ⇒ Object
- #warn? ⇒ Boolean
Constructor Details
#initialize(name:, status:, message: nil, prescription: nil, auto_fixable: false, weight: 1.0) ⇒ Result
rubocop:disable Metrics/ParameterLists
11 12 13 14 15 16 17 18 |
# File 'lib/legion/cli/doctor/result.rb', line 11 def initialize(name:, status:, message: nil, prescription: nil, auto_fixable: false, weight: 1.0) # rubocop:disable Metrics/ParameterLists @name = name @status = status @message = @prescription = prescription @auto_fixable = auto_fixable @weight = weight end |
Instance Attribute Details
#auto_fixable ⇒ Object (readonly)
Returns the value of attribute auto_fixable.
9 10 11 |
# File 'lib/legion/cli/doctor/result.rb', line 9 def auto_fixable @auto_fixable end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'lib/legion/cli/doctor/result.rb', line 9 def @message end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/legion/cli/doctor/result.rb', line 9 def name @name end |
#prescription ⇒ Object (readonly)
Returns the value of attribute prescription.
9 10 11 |
# File 'lib/legion/cli/doctor/result.rb', line 9 def prescription @prescription end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
9 10 11 |
# File 'lib/legion/cli/doctor/result.rb', line 9 def status @status end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
9 10 11 |
# File 'lib/legion/cli/doctor/result.rb', line 9 def weight @weight end |
Instance Method Details
#fail? ⇒ Boolean
28 29 30 |
# File 'lib/legion/cli/doctor/result.rb', line 28 def fail? status == :fail end |
#pass? ⇒ Boolean
24 25 26 |
# File 'lib/legion/cli/doctor/result.rb', line 24 def pass? status == :pass end |
#score ⇒ Object
20 21 22 |
# File 'lib/legion/cli/doctor/result.rb', line 20 def score SCORE_MAP[status] end |
#skip? ⇒ Boolean
36 37 38 |
# File 'lib/legion/cli/doctor/result.rb', line 36 def skip? status == :skip end |
#to_h ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/legion/cli/doctor/result.rb', line 40 def to_h { name: name, status: status, score: score, weight: weight, message: , prescription: prescription, auto_fixable: auto_fixable }.compact end |
#warn? ⇒ Boolean
32 33 34 |
# File 'lib/legion/cli/doctor/result.rb', line 32 def warn? status == :warn end |