Class: StructuredReader::JSONReader::Context
- Inherits:
-
Object
- Object
- StructuredReader::JSONReader::Context
- Defined in:
- lib/structured_reader.rb
Instance Method Summary collapse
- #accept(fragment) ⇒ Object
- #flunk(fragment, reason) ⇒ Object
-
#initialize(where = "") ⇒ Context
constructor
A new instance of Context.
- #push(path) {|self.class.new(@where + path)| ... } ⇒ Object
Constructor Details
#initialize(where = "") ⇒ Context
Returns a new instance of Context.
315 316 317 |
# File 'lib/structured_reader.rb', line 315 def initialize(where = "") @where = where.dup.freeze end |
Instance Method Details
#accept(fragment) ⇒ Object
319 320 321 |
# File 'lib/structured_reader.rb', line 319 def accept(fragment) fragment end |
#flunk(fragment, reason) ⇒ Object
323 324 325 |
# File 'lib/structured_reader.rb', line 323 def flunk(fragment, reason) raise WrongTypeError, "#{reason}, got a #{fragment.class} (at #{@where})" end |
#push(path) {|self.class.new(@where + path)| ... } ⇒ Object
327 328 329 |
# File 'lib/structured_reader.rb', line 327 def push(path, &blk) yield self.class.new(@where + path) end |