Sha256: d6b9a2cf90849450145ffc318236e5c74b1dadf2c7f514f926c293fdfc2bd934

Contents?: true

Size: 362 Bytes

Versions: 4

Compression:

Stored size: 362 Bytes

Contents

class InputSanitizer::V2::NestedSanitizerFactory
  class NilAllowed
    def cleaned
      nil
    end

    def valid?
      true
    end
  end

  def self.for(nested_sanitizer_klass, value, options)
    if value.nil? && options[:allow_nil] && !options[:collection]
      NilAllowed.new
    else
      nested_sanitizer_klass.new(value, options)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
input_sanitizer-0.5.0 lib/input_sanitizer/v2/nested_sanitizer_factory.rb
input_sanitizer-0.4.1 lib/input_sanitizer/v2/nested_sanitizer_factory.rb
input_sanitizer-0.4.0 lib/input_sanitizer/v2/nested_sanitizer_factory.rb
input_sanitizer-0.3.33 lib/input_sanitizer/v2/nested_sanitizer_factory.rb