Class: Kumi::Core::Input::ViolationCreator
- Inherits:
-
Object
- Object
- Kumi::Core::Input::ViolationCreator
- Defined in:
- lib/kumi/core/input/violation_creator.rb
Class Method Summary collapse
- .create_domain_violation(field, value, domain) ⇒ Object
- .create_missing_field_violation(field, expected_type) ⇒ Object
- .create_type_violation(field, value, expected_type) ⇒ Object
Class Method Details
.create_domain_violation(field, value, domain) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/kumi/core/input/violation_creator.rb', line 18 def self.create_domain_violation(field, value, domain) { type: :domain_violation, field: field, value: value, domain: domain, message: Kumi::Core::Domain::ViolationFormatter.(field, value, domain) } end |
.create_missing_field_violation(field, expected_type) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/kumi/core/input/violation_creator.rb', line 28 def self.create_missing_field_violation(field, expected_type) { type: :missing_field_violation, field: field, expected_type: expected_type, message: (field, expected_type) } end |
.create_type_violation(field, value, expected_type) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/kumi/core/input/violation_creator.rb', line 7 def self.create_type_violation(field, value, expected_type) { type: :type_violation, field: field, value: value, expected_type: expected_type, actual_type: TypeMatcher.infer_type(value), message: (field, value, expected_type) } end |