Sha256: a32677fee717b440baa099d38e0fd4122a891c1d8ade8cdea47566d640f841d9
Contents?: true
Size: 393 Bytes
Versions: 5
Compression:
Stored size: 393 Bytes
Contents
module InputSanitizer class CommaJoinedIntegersConverter def call(value) value = value.to_s non_valid = value.gsub(/[0-9,]/, "") if non_valid.empty? value.split(",").map(&:to_i) else invalid_chars = non_valid.split(//).join(", ") raise InputSanitizer::ConversionError.new("Invalid integers: #{invalid_chars}") end end end end
Version data entries
5 entries across 5 versions & 1 rubygems