Class: StructuredReader::JSONReader::LiteralReader
- Inherits:
-
Object
- Object
- StructuredReader::JSONReader::LiteralReader
- Defined in:
- lib/structured_reader.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(value:, **_) ⇒ LiteralReader
constructor
A new instance of LiteralReader.
- #read(fragment, context) ⇒ Object
Constructor Details
#initialize(value:, **_) ⇒ LiteralReader
Returns a new instance of LiteralReader.
212 213 214 |
# File 'lib/structured_reader.rb', line 212 def initialize(value:, **_) @value = value end |
Instance Method Details
#read(fragment, context) ⇒ Object
216 217 218 219 220 221 222 |
# File 'lib/structured_reader.rb', line 216 def read(fragment, context) if fragment == @value context.accept fragment else context.flunk(fragment, "expected #{@value.inspect}") end end |