Class: Herb::Warnings::Warning
- Inherits:
-
Object
- Object
- Herb::Warnings::Warning
- Defined in:
- lib/herb/warnings.rb,
sig/herb/warnings.rbs
Overview
: type serialized_warning = { | type: String, | location: serialized_location?, | message: String | }
Instance Attribute Summary collapse
-
#location ⇒ Location?
readonly
: Location?.
-
#message ⇒ String
readonly
: String.
-
#type ⇒ String
readonly
: String.
Instance Method Summary collapse
-
#class_name ⇒ String
: () -> String.
-
#initialize(type, location, message) ⇒ Warning
constructor
: (String, Location, String) -> void.
-
#to_hash ⇒ serialized_warning
: () -> serialized_warning.
-
#to_json(state = nil) ⇒ String
: (?untyped) -> String.
-
#warning_name ⇒ String
: () -> String.
Constructor Details
#initialize(type, location, message) ⇒ Warning
: (String, Location, String) -> void
17 18 19 20 21 |
# File 'lib/herb/warnings.rb', line 17 def initialize(type, location, ) @type = type @location = location @message = end |
Instance Attribute Details
#location ⇒ Location? (readonly)
: Location?
13 14 15 |
# File 'lib/herb/warnings.rb', line 13 def location @location end |
#message ⇒ String (readonly)
: String
14 15 16 |
# File 'lib/herb/warnings.rb', line 14 def @message end |
#type ⇒ String (readonly)
: String
12 13 14 |
# File 'lib/herb/warnings.rb', line 12 def type @type end |
Instance Method Details
#class_name ⇒ String
: () -> String
33 34 35 |
# File 'lib/herb/warnings.rb', line 33 def class_name self.class.name || "Warning" end |
#to_hash ⇒ serialized_warning
: () -> serialized_warning
24 25 26 27 28 29 30 |
# File 'lib/herb/warnings.rb', line 24 def to_hash { type: type, location: location&.to_hash, message: , } end |
#to_json(state = nil) ⇒ String
: (?untyped) -> String
43 44 45 |
# File 'lib/herb/warnings.rb', line 43 def to_json(state = nil) to_hash.to_json(state) end |
#warning_name ⇒ String
: () -> String
38 39 40 |
# File 'lib/herb/warnings.rb', line 38 def warning_name class_name.split("::").last || "Warning" end |