Sha256: cdca2936fbdc5dde707e3c90da6701ba267b796a4cf8fb3d768c50d3cd552506

Contents?: true

Size: 347 Bytes

Versions: 27

Compression:

Stored size: 347 Bytes

Contents

# frozen_string_literal: true

# only needed when ruby < 2.4 and not using active support

unless {}.respond_to? :compact
  # https://github.com/rails/rails/blob/fc5dd0b85189811062c85520fd70de8389b55aeb/activesupport/lib/active_support/core_ext/hash/compact.rb
  class Hash
    def compact
      select { |_, value| !value.nil? }
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
racecar-2.4.0 lib/ensure_hash_compact.rb
racecar-2.3.1 lib/ensure_hash_compact.rb
racecar-2.3.0 lib/ensure_hash_compact.rb
racecar-2.3.0.alpha1 lib/ensure_hash_compact.rb
racecar-2.2.0 lib/ensure_hash_compact.rb
racecar-2.1.1 lib/ensure_hash_compact.rb
racecar-2.1.0 lib/ensure_hash_compact.rb