class Hash
class Mediator < BasicObject
def initialize(hash, *syms)
@h = hash
@syms = syms
end
def method_missing(name, *args)
@h.has_key?(name) ? @h[name] : super
end
def mediate(&block)
instance_eval(&block)
end
end
def pick(*syms, &block)
Mediator.new(self, *syms).mediate(&block)
end
end