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.
206 207 208 |
# File 'lib/structured_reader.rb', line 206 def initialize(value:, **_) @value = value end |
Instance Method Details
#read(fragment, context) ⇒ Object
210 211 212 213 214 215 216 |
# File 'lib/structured_reader.rb', line 210 def read(fragment, context) if fragment == @value context.accept fragment else context.flunk(fragment, "expected #{@value.inspect}") end end |