Class: Ibex::RaccMigration::Finding
- Inherits:
-
Object
- Object
- Ibex::RaccMigration::Finding
- Defined in:
- lib/ibex/racc_migration/report.rb
Overview
One immutable migration compatibility observation.
Constant Summary collapse
- SEVERITIES =
: Array
%i[error warning info].freeze
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
: String.
-
#location ⇒ Object
readonly
: Frontend::Location?.
-
#message ⇒ Object
readonly
: String.
-
#severity ⇒ Object
readonly
: Symbol.
-
#suggestion ⇒ Object
readonly
: String.
Instance Method Summary collapse
-
#initialize(code:, severity:, message:, location:, suggestion:) ⇒ Finding
constructor
A new instance of Finding.
- #to_h ⇒ Object
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 ⇒ Object (readonly)
: String
12 13 14 |
# File 'lib/ibex/racc_migration/report.rb', line 12 def code @code end |
#location ⇒ Object (readonly)
: Frontend::Location?
15 16 17 |
# File 'lib/ibex/racc_migration/report.rb', line 15 def location @location end |
#message ⇒ Object (readonly)
: String
14 15 16 |
# File 'lib/ibex/racc_migration/report.rb', line 14 def @message end |
#severity ⇒ Object (readonly)
: Symbol
13 14 15 |
# File 'lib/ibex/racc_migration/report.rb', line 13 def severity @severity end |
#suggestion ⇒ Object (readonly)
: String
16 17 18 |
# File 'lib/ibex/racc_migration/report.rb', line 16 def suggestion @suggestion end |
Instance Method Details
#to_h ⇒ Object
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 |