Sha256: eb3930addc9ca0b511d3c98875254a144d7f81394fa02196ab7d8e3cabc435d3

Contents?: true

Size: 288 Bytes

Versions: 11

Compression:

Stored size: 288 Bytes

Contents

# frozen_string_literal: true

module ValidateParams
  class Types
    class IO
      def self.valid?(value)
        value.class.method_defined?(:size)
      end

      def self.cast(raw_value, **)
        return nil if raw_value.size.zero?

        raw_value
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
validate-params-0.14.0 lib/validate_params/types/i_o.rb
validate-params-0.13.1 lib/validate_params/types/i_o.rb
validate-params-0.13.0 lib/validate_params/types/i_o.rb
validate-params-0.12.5 lib/validate_params/types/i_o.rb
validate-params-0.12.4 lib/validate_params/types/i_o.rb
validate-params-0.12.3 lib/validate_params/types/i_o.rb
validate-params-0.12.2 lib/validate_params/types/i_o.rb
validate-params-0.12.1 lib/validate_params/types/i_o.rb
validate-params-0.12.0 lib/validate_params/types/i_o.rb
validate-params-0.11.0 lib/validate_params/types/i_o.rb
validate-params-0.10.1 lib/validate_params/types/i_o.rb