Sha256: 3afc115b9ebaaf11d35b56b6dd745bc9654988d63da8c3e4fcc75f16af45d3ef
Contents?: true
Size: 676 Bytes
Versions: 2
Compression:
Stored size: 676 Bytes
Contents
# frozen_string_literal: true # # Abstraction over WebMock to reduce duplication # # @author Mikael Henriksson <mikael@zoolutions.se> # @since 0.1.0 # module StubRequests # # Provides convenience methods for hashes # module HashUtil # # Removes all entries with nil values (first level only) # # @param [Hash] options the hash to compact # # @return [Hash, nil] Returns # # @yieldparam [Hash] compacted the hash without nils # @yieldreturn [void] def self.compact(options) return if options.blank? compacted = options.delete_if { |_, val| val.blank? } yield compacted if compacted.present? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stub_requests-0.1.1 | lib/stub_requests/hash_util.rb |
stub_requests-0.1.0 | lib/stub_requests/hash_util.rb |