Method: JSONSchemer::Result#classic

Defined in:
lib/json_schemer/result.rb

#classicObject

[View source]

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/json_schemer/result.rb', line 173

def classic
  Enumerator.new do |yielder|
    unless valid
      results = [self]
      while result = results.pop
        if result.ignore_nested || !result.nested&.any?
          yielder << result.to_classic
        else
          previous_results_size = results.size
          result.nested.reverse_each do |nested_result|
            results << nested_result if nested_result.valid == valid
          end
          yielder << result.to_classic if (results.size - previous_results_size) == 0
        end
      end
    end
  end
end