Class: StructuredReader::JSONReader::NumberReader

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

Instance Method Summary collapse

Constructor Details

#initialize(**_) ⇒ NumberReader

Returns a new instance of NumberReader.



158
159
160
# File 'lib/structured_reader.rb', line 158

def initialize(**_)

end

Instance Method Details

#read(fragment, context) ⇒ Object



162
163
164
165
166
167
168
# File 'lib/structured_reader.rb', line 162

def read(fragment, context)
  if fragment.kind_of?(Numeric)
    context.accept fragment
  else
    context.flunk(fragment, "expected a Numeric")
  end
end