Class: AbideDevUtils::CEM::Validate::Strings::ValidationFinding

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/cem/validate/strings/validation_finding.rb

Overview

Represents a validation finding (warning or error)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, title, data) ⇒ ValidationFinding

Returns a new instance of ValidationFinding.

Raises:

  • (ArgumentError)


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

#dataObject (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

#titleObject (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

#typeObject (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_hashObject 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_sObject



19
20
21
# File 'lib/abide_dev_utils/cem/validate/strings/validation_finding.rb', line 19

def to_s
  "#{@type}: #{@title}: #{@data}"
end