Class: JSONSkooma::Keywords::Applicator::PrefixItems
- Defined in:
- lib/json_skooma/keywords/applicator/prefix_items.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#each_schema, inherited, #initialize, #instance_types, #key, #resolve, set_defaults, #static, value_schema=
Constructor Details
This class inherits a constructor from JSONSkooma::Keywords::Base
Instance Method Details
#evaluate(instance, result) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/json_skooma/keywords/applicator/prefix_items.rb', line 11 def evaluate(instance, result) annotation = nil error = [] instance.take(json.value.length).each_with_index do |item, index| annotation = index result.call(item, index.to_s) do |subresult| unless json[index].evaluate(item, subresult).passed? error << index end end end return result.failure(error) unless error.empty? return if annotation.nil? annotation = true if annotation == instance.length - 1 result.annotate(annotation) end |