Sha256: 561fa0dea3274baa416a44abe4df41142ed48373e7d770b59e7351dcd4a54bcc
Contents?: true
Size: 438 Bytes
Versions: 9
Compression:
Stored size: 438 Bytes
Contents
# encoding: UTF-8 module Spontaneous::Collections class HashWithFallback < Hash def initialize(fallback, use_fallback_proc, obj = nil, &block) use_fallback_proc ||= proc { |val| val.nil? } @fallback, @use_fallback_proc = fallback, use_fallback_proc super(obj, &block) end def [](key) val = super if @use_fallback_proc[val] val = @fallback[key] end val end end end
Version data entries
9 entries across 9 versions & 1 rubygems