Sha256: 5d86979de8044a649f66c4f000f7a262f6557be48fd4eda4afb40bc1134aaa1a
Contents?: true
Size: 394 Bytes
Versions: 5
Compression:
Stored size: 394 Bytes
Contents
module Decanter module Parser class IntegerParser < ValueParser REGEX = /(\d|[.]|[-])/ allow Integer parser do |val, options| raise Decanter::ParseError.new 'Expects a single value' if val.is_a? Array next if (val.nil? || val === '') val.is_a?(Float) ? val.to_i : val.scan(REGEX).join.try(:to_i) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems