Class: Ibex::RaccMigration::Finding
- Inherits:
-
Object
- Object
- Ibex::RaccMigration::Finding
- Defined in:
- lib/ibex/racc_migration/report.rb,
sig/ibex/racc_migration/report.rbs
Overview
One immutable migration compatibility observation.
Constant Summary collapse
- SEVERITIES =
%i[error warning info].freeze
Instance Attribute Summary collapse
- #code ⇒ String readonly
- #location ⇒ Frontend::Location? readonly
- #message ⇒ String readonly
- #severity ⇒ Symbol readonly
- #suggestion ⇒ String readonly
Instance Method Summary collapse
-
#initialize(code:, severity:, message:, location:, suggestion:) ⇒ Finding
constructor
A new instance of Finding.
- #to_h ⇒ Hash[String, untyped]
Constructor Details
#initialize(code:, severity:, message:, location:, suggestion:) ⇒ Finding
Returns a new instance of Finding.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ibex/racc_migration/report.rb', line 20 def initialize(code:, severity:, message:, location:, suggestion:) unless SEVERITIES.include?(severity) raise ArgumentError, "unknown migration finding severity #{severity.inspect}" end @code = code.dup.freeze @severity = severity @message = .dup.freeze @location = location @suggestion = suggestion.dup.freeze freeze end |
Instance Attribute Details
#code ⇒ String (readonly)
12 13 14 |
# File 'lib/ibex/racc_migration/report.rb', line 12 def code @code end |
#location ⇒ Frontend::Location? (readonly)
15 16 17 |
# File 'lib/ibex/racc_migration/report.rb', line 15 def location @location end |
#message ⇒ String (readonly)
14 15 16 |
# File 'lib/ibex/racc_migration/report.rb', line 14 def @message end |
#severity ⇒ Symbol (readonly)
13 14 15 |
# File 'lib/ibex/racc_migration/report.rb', line 13 def severity @severity end |
#suggestion ⇒ String (readonly)
16 17 18 |
# File 'lib/ibex/racc_migration/report.rb', line 16 def suggestion @suggestion end |
Instance Method Details
#to_h ⇒ Hash[String, untyped]
34 35 36 37 38 39 40 41 42 |
# File 'lib/ibex/racc_migration/report.rb', line 34 def to_h { "code" => @code, "severity" => @severity.to_s, "message" => @message, "location" => @location&.to_h&.transform_keys(&:to_s), "suggestion" => @suggestion } end |