Class: DomainSanity::Reason

Inherits:
Struct
  • Object
show all
Defined in:
lib/domain_sanity/reason.rb

Overview

A single, structured reason a subject failed validation.

code is a stable Symbol meant for programmatic branching (it does not change when the wording of a message is tweaked). message is the human-readable explanation. label is the specific offending DNS label when one applies (e.g. a label that is too long or malformed), and nil otherwise.

Reason#to_s returns the message, so an array of reasons still interpolates and joins into readable text, while callers that need to react in code can switch on code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



15
16
17
# File 'lib/domain_sanity/reason.rb', line 15

def code
  @code
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



15
16
17
# File 'lib/domain_sanity/reason.rb', line 15

def label
  @label
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



15
16
17
# File 'lib/domain_sanity/reason.rb', line 15

def message
  @message
end

Instance Method Details

#to_sObject



16
17
18
# File 'lib/domain_sanity/reason.rb', line 16

def to_s
  message
end