Class: Ukiryu::Validation::ValidationIssue

Inherits:
StandardError show all
Defined in:
lib/ukiryu/validation/constraints.rb

Overview

Validation issue represents a single validation problem

This is a proper error object, not just a string.

Constant Summary

Constants inherited from StandardError

StandardError::FILENO

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from StandardError

stderr?

Constructor Details

#initialize(attribute_name, validation_type, message) ⇒ ValidationIssue

Returns a new instance of ValidationIssue.

Parameters:

  • attribute_name (String, Symbol)

    the attribute that failed

  • validation_type (Symbol)

    the type of validation

  • message (String)

    human-readable error message



273
274
275
276
277
278
# File 'lib/ukiryu/validation/constraints.rb', line 273

def initialize(attribute_name, validation_type, message)
  @attribute_name = attribute_name
  @validation_type = validation_type
  @message = message
  super(message)
end

Instance Attribute Details

#attribute_nameObject (readonly)

The attribute name that failed validation



262
263
264
# File 'lib/ukiryu/validation/constraints.rb', line 262

def attribute_name
  @attribute_name
end

#messageObject (readonly)

Human-readable error message



268
269
270
# File 'lib/ukiryu/validation/constraints.rb', line 268

def message
  @message
end

#validation_typeObject (readonly)

The type of validation that failed



265
266
267
# File 'lib/ukiryu/validation/constraints.rb', line 265

def validation_type
  @validation_type
end