Cute method_missing hack
March 6th, 2008
I love abusing method_missing in Ruby, it is great fun.
module IsDoesIsntDoesnt
def method_missing(method, *args)
m = method.to_s
if (m =~ /^is_(\w*?\?)$/) || (m =~ /^does_(\w*?\?)$/)
real_method = $1.to_sym
return send(real_method, *args) if respond_to?(real_method)
elsif (m [...]
[ Back to top ]







