Class: AbideDevUtils::CEM::Validate::Strings::ValidationFinding
- Inherits:
-
Object
- Object
- AbideDevUtils::CEM::Validate::Strings::ValidationFinding
- Defined in:
- lib/abide_dev_utils/cem/validate/strings/validation_finding.rb
Overview
Represents a validation finding (warning or error)
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, title, data) ⇒ ValidationFinding
constructor
A new instance of ValidationFinding.
- #to_hash ⇒ Object (also: #to_h)
- #to_s ⇒ Object
Constructor Details
#initialize(type, title, data) ⇒ ValidationFinding
Returns a new instance of ValidationFinding.
11 12 13 14 15 16 17 |
# File 'lib/abide_dev_utils/cem/validate/strings/validation_finding.rb', line 11 def initialize(type, title, data) raise ArgumentError, 'type must be :error or :warning' unless %i[error warning].include?(type) @type = type.to_sym @title = title.to_sym @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/abide_dev_utils/cem/validate/strings/validation_finding.rb', line 9 def data @data end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/abide_dev_utils/cem/validate/strings/validation_finding.rb', line 9 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/abide_dev_utils/cem/validate/strings/validation_finding.rb', line 9 def type @type end |
Instance Method Details
#to_hash ⇒ Object Also known as: to_h
23 24 25 |
# File 'lib/abide_dev_utils/cem/validate/strings/validation_finding.rb', line 23 def to_hash { type: @type, title: @title, data: @data } end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/abide_dev_utils/cem/validate/strings/validation_finding.rb', line 19 def to_s "#{@type}: #{@title}: #{@data}" end |