Class: ZplRenderer::Validation::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/zpl_renderer/validation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorsObject

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



9
10
11
# File 'lib/zpl_renderer/validation.rb', line 9

def errors
  @errors
end

#ok?Object

Returns the value of attribute ok?

Returns:

  • (Object)

    the current value of ok?



9
10
11
# File 'lib/zpl_renderer/validation.rb', line 9

def ok?
  @ok?
end

#warningsObject

Returns the value of attribute warnings

Returns:

  • (Object)

    the current value of warnings



9
10
11
# File 'lib/zpl_renderer/validation.rb', line 9

def warnings
  @warnings
end

Instance Method Details

#raise_if_strict!(strict:) ⇒ Object

Raises:



10
11
12
13
14
15
# File 'lib/zpl_renderer/validation.rb', line 10

def raise_if_strict!(strict:)
  return self if ok? || !strict
  return self if errors.empty?

  raise ValidationError, errors.join("; ")
end