Sha256: fc5a0751857c64040fae8c160fe8f83d5e0aa4c7f795e47e4c10fbccab870063
Contents?: true
Size: 483 Bytes
Versions: 24
Compression:
Stored size: 483 Bytes
Contents
module JSONAPIonify::Types class IntegerType < BaseType def sample(*) rand(1..123) end loader do |value| raise LoadError, 'input value was not an integer' unless value.is_a?(Fixnum) value end dumper do |value| raise DumpError, 'cannot convert value to integer' unless value.respond_to?(:to_i) value.to_i.tap do |int| raise DumpError, 'output value was not a integer' unless int.is_a? Fixnum end end end end
Version data entries
24 entries across 24 versions & 1 rubygems