Sha256: ec7d86e17cc4384f80806cfbc2acb603d52f15b0f7cd4ef33801eade0e867030

Contents?: true

Size: 295 Bytes

Versions: 3

Compression:

Stored size: 295 Bytes

Contents

# frozen_string_literal: true

class Hash
  class ToHashMapper
    def initialize(hash)
      @hash = hash
    end

    def map
      {}.tap do |new_hash|
        hash.each do |k, v|
          new_hash[k] = yield(k, v)
        end
      end
    end

    private

    attr_reader :hash
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
darthjee-core_ext-1.6.2 lib/darthjee/core_ext/hash/to_hash_mapper.rb
darthjee-core_ext-1.6.1 lib/darthjee/core_ext/hash/to_hash_mapper.rb
darthjee-core_ext-1.6.0 lib/darthjee/core_ext/hash/to_hash_mapper.rb