2007-12-28 05:18:05 +03:00
|
|
|
SCRIPT_LINES__={}
|
|
|
|
|
2007-12-25 10:04:30 +03:00
|
|
|
class Object
|
|
|
|
def method_missing m, *a, &b
|
|
|
|
r = /^#{m}/
|
|
|
|
t = (methods + private_methods).sort.find{|e|r=~e}
|
|
|
|
t ? __send__(t, *a, &b) : super
|
|
|
|
end
|
2007-12-25 10:42:53 +03:00
|
|
|
|
2007-12-28 04:07:21 +03:00
|
|
|
def self.const_missing c
|
|
|
|
r = /^#{c}/
|
|
|
|
t = constants.sort.find{|e|r=~e}
|
|
|
|
t ? const_get(t) : superclass.const_get(c)
|
|
|
|
end
|
|
|
|
|
2007-12-25 10:42:53 +03:00
|
|
|
def h(a='H', b='w', c='!')
|
|
|
|
puts "#{a}ello, #{b}orld#{c}"
|
|
|
|
end
|
2007-12-28 05:18:05 +03:00
|
|
|
|
|
|
|
def quine(src = $0)
|
|
|
|
SCRIPT_LINES__[src]
|
|
|
|
end
|
2007-12-25 10:04:30 +03:00
|
|
|
end
|
2007-12-27 19:47:58 +03:00
|
|
|
|
|
|
|
class Integer
|
|
|
|
def each(&b)
|
|
|
|
times &b
|
|
|
|
end
|
|
|
|
|
|
|
|
include Enumerable
|
|
|
|
end
|