Sha256: 726c5fbb17643830170c4700b7dca17102507f3c9128a4c93b68d3d228903b91

Contents?: true

Size: 458 Bytes

Versions: 1

Compression:

Stored size: 458 Bytes

Contents

# frozen_string_literal: true

class Hash
  module Transformable
    def squash
      Squasher.squash(self)
    end

    def to_deep_hash(separator = '.')
      Hash::DeepHashConstructor.new(separator).deep_hash(self)
    end

    def map_to_hash(&block)
      ToHashMapper.new(self).map(&block)
    end

    def exclusive_merge(hash)
      dup.exclusive_merge!(hash)
    end

    def exclusive_merge!(hash)
      merge!(hash.slice(*keys))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
darthjee-core_ext-1.6.2 lib/darthjee/core_ext/hash/transformable.rb