Class: StructuredReader::JSONReader::ValidatorContext

Inherits:
Object
  • Object
show all
Defined in:
lib/structured_reader.rb

Instance Method Summary collapse

Constructor Details

#initialize(where = "", errors = []) ⇒ ValidatorContext

Returns a new instance of ValidatorContext.



335
336
337
338
# File 'lib/structured_reader.rb', line 335

def initialize(where = "", errors = [])
  @where = where.dup.freeze
  @errors = errors
end

Instance Method Details

#accept(fragment) ⇒ Object



340
341
342
# File 'lib/structured_reader.rb', line 340

def accept(fragment)
  @errors
end

#flunk(fragment, reason) ⇒ Object



344
345
346
# File 'lib/structured_reader.rb', line 344

def flunk(fragment, reason)
  @errors << [@where, reason]
end

#push(path) {|self.class.new(@where + path, @errors)| ... } ⇒ Object

Yields:

  • (self.class.new(@where + path, @errors))


348
349
350
# File 'lib/structured_reader.rb', line 348

def push(path)
  yield self.class.new(@where + path, @errors)
end