| Conditions | 5 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # frozen_string_literal: true |
||
| 21 | def validate(value, attr, ctx) |
||
| 22 | violations = @validator.validate(value, attr, ctx) do |v, a, c| |
||
| 23 | API::Default::AttributeValidator::INSTANCE.validate(v, a, c) |
||
| 24 | end |
||
| 25 | violations = [violations] if violations.is_a?(String) |
||
| 26 | violations.nil? ? [] : violations |
||
| 27 | rescue StandardError => e |
||
| 28 | raise_if_internal(e) |
||
| 29 | message = "Error during #{attr} validation (value: #{value})" |
||
| 30 | if e.is_a?(ArgumentError) |
||
| 31 | message += '. Does provided validator have ' \ |
||
| 32 | '(value, attribute, context) signature?' |
||
| 33 | end |
||
| 34 | compliance_error(message, context: ctx, parent: e) |
||
| 35 | end |
||
| 36 | end |
||
| 42 |