Sha256: 829951a757b7650be6179000fa5eb3bf632ace596d41c0556dcf51c1ce03db74

Contents?: true

Size: 377 Bytes

Versions: 3

Compression:

Stored size: 377 Bytes

Contents

# frozen_string_literal: true

require "validate_params/utilities/scrubber"

module ValidateParams
  class Types
    class String
      def self.cast(raw_value, scrub_invalid_utf8: false, **)
        value = raw_value.to_s

        if scrub_invalid_utf8
          value = Validatable::Utilities::Scrubber.scrub(raw_value)
        end

        value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
validate-params-0.14.0 lib/validate_params/types/string.rb
validate-params-0.13.1 lib/validate_params/types/string.rb
validate-params-0.13.0 lib/validate_params/types/string.rb