class StructuredReader::JSONReader::ValidatorContext
Constants
- Result
Public Class Methods
new(where = "", errors = [])
click to toggle source
# File lib/structured_reader.rb, line 353 def initialize(where = "", errors = []) @where = where.dup.freeze @errors = errors end
Public Instance Methods
accept(fragment)
click to toggle source
# File lib/structured_reader.rb, line 363 def accept(fragment) fragment end
flunk(fragment, reason)
click to toggle source
# File lib/structured_reader.rb, line 367 def flunk(fragment, reason) @errors << [@where, reason] end
open(&blk)
click to toggle source
# File lib/structured_reader.rb, line 358 def open(&blk) result = blk.call(self) Result.new(@errors.any? ? nil : result, @errors) end
push(path) { |class.new(where + path, errors)| ... }
click to toggle source
# File lib/structured_reader.rb, line 371 def push(path) yield self.class.new(@where + path, @errors) end