This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
module Kernel | |
h = Hash.new | |
define_method(:requiree) do | |
h | |
end | |
r = method :require | |
define_method(:require) do |a| | |
r.call(a) | |
h[a] = caller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OpenHash is a hash with a #method_missing method | |
# that routes to [] and []=. | |
class OpenHash < Hash | |
def method_missing(s, *a) | |
case s | |
when /\?$/ | |
self.key?(s.chomp('?')) | |
when /\=$/ | |
self[s] = a[0] | |
else |
NewerOlder