Sha256: d6fb57964d206b1c5b046f4ae30ddf928b22bd98945adb1fc0d590e61ee818bd
Contents?: true
Size: 395 Bytes
Versions: 5
Compression:
Stored size: 395 Bytes
Contents
module InputSanitizer class CommaJoinedStringsConverter def call(value) value = value.to_s non_valid = value.gsub(/[a-zA-Z,_]/, "") if non_valid.empty? value.split(",").map(&:to_s) else invalid_chars = non_valid.split(//).join(", ") raise InputSanitizer::ConversionError.new("Invalid strings: #{invalid_chars}") end end end end
Version data entries
5 entries across 5 versions & 1 rubygems