Sha256: e5e20b2bec5205ad35cb34e9fe3736cf27ada37f4f0f828e0a60363606b5c066

Contents?: true

Size: 520 Bytes

Versions: 43

Compression:

Stored size: 520 Bytes

Contents

module Plutonium
  module Support
    module Parameters
      class << self
        def nilify(params)
          params.transform_values { |value| nilify_internal(value) }
        end

        private

        def nilify_internal(value)
          case value
          when String
            value.presence
          when Hash
            nilify value
          when Array
            value.map { |val| nilify_internal val }.compact
          else
            value
          end
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
plutonium-0.19.8 lib/plutonium/support/parameters.rb
plutonium-0.19.7 lib/plutonium/support/parameters.rb
plutonium-0.19.6 lib/plutonium/support/parameters.rb
plutonium-0.19.5 lib/plutonium/support/parameters.rb
plutonium-0.19.4 lib/plutonium/support/parameters.rb
plutonium-0.19.3 lib/plutonium/support/parameters.rb
plutonium-0.19.2 lib/plutonium/support/parameters.rb
plutonium-0.19.1 lib/plutonium/support/parameters.rb
plutonium-0.19.0 lib/plutonium/support/parameters.rb
plutonium-0.18.8 lib/plutonium/support/parameters.rb
plutonium-0.18.7 lib/plutonium/support/parameters.rb
plutonium-0.18.6 lib/plutonium/support/parameters.rb
plutonium-0.18.5 lib/plutonium/support/parameters.rb
plutonium-0.18.4 lib/plutonium/support/parameters.rb
plutonium-0.18.3 lib/plutonium/support/parameters.rb
plutonium-0.18.2 lib/plutonium/support/parameters.rb
plutonium-0.18.1 lib/plutonium/support/parameters.rb
plutonium-0.18.0 lib/plutonium/support/parameters.rb
plutonium-0.16.5 lib/plutonium/support/parameters.rb
plutonium-0.16.4 lib/plutonium/support/parameters.rb