Sha256: 8b6441b274d3f6e7faadd80cc6915a6688b54d8e9da7cce239a10aae8fa67bbd
Contents?: true
Size: 395 Bytes
Versions: 16
Compression:
Stored size: 395 Bytes
Contents
# frozen_string_literal: true # encoding: utf-8 class UsingHash < Hash def use(key) wrap(self[key]).tap do delete(key) end end def use!(key) wrap(fetch(key)).tap do delete(key) end end private def wrap(v) case v when Hash self.class[v] when Array v.map do |subv| wrap(subv) end else v end end end
Version data entries
16 entries across 16 versions & 1 rubygems