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.



164
165
166
# File 'lib/structured_reader.rb', line 164

def initialize(**_)

end

Instance Method Details

#read(fragment, context) ⇒ Object



168
169
170
171
172
173
174
# File 'lib/structured_reader.rb', line 168

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