Class: UniformArrayValidation
Constant Summary
Constants included
from Inspectable
Inspectable::INSPECTING_KEY
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Validation
#as_object_members, #expects_an_object?, memoized_new_from_pattern, new_from_pattern, #validate_from_root
#initialize
#==
#inspect
Instance Attribute Details
#value_validation ⇒ Object
Returns the value of attribute value_validation.
433
434
435
|
# File 'lib/json_patterns.rb', line 433
def value_validation
@value_validation
end
|
Instance Method Details
#shallow_describe ⇒ Object
451
452
453
|
# File 'lib/json_patterns.rb', line 451
def shallow_describe
Set['array']
end
|
#shallow_match?(data) ⇒ Boolean
447
448
449
|
# File 'lib/json_patterns.rb', line 447
def shallow_match?(data)
data.is_a? Array
end
|
#to_s ⇒ Object
455
456
457
|
# File 'lib/json_patterns.rb', line 455
def to_s
"[ #{@value_validation}, ... ]"
end
|
#validate(path, data) ⇒ Object
435
436
437
438
439
440
441
442
443
444
445
|
# File 'lib/json_patterns.rb', line 435
def validate(path, data)
if data.is_a? Array
return validate_members(path, data)
else
return [ValidationUnexpected.new(
path: path,
expected: 'array',
found: json_type_name(data),
)]
end
end
|