2007-12-28 02:18:05 +00:00
|
|
|
SCRIPT_LINES__={}
|
|
|
|
|
2007-12-25 07:04:30 +00:00
|
|
|
class Object
|
2007-12-30 14:20:37 +00:00
|
|
|
@@golf_hash = {}
|
2007-12-25 07:04:30 +00:00
|
|
|
def method_missing m, *a, &b
|
2007-12-30 14:20:37 +00:00
|
|
|
t = @@golf_hash[[m,self.class]] ||= (methods + private_methods).sort.find{|e|/^#{m}/=~e}
|
2007-12-25 07:04:30 +00:00
|
|
|
t ? __send__(t, *a, &b) : super
|
|
|
|
end
|
2007-12-25 07:42:53 +00:00
|
|
|
|
2007-12-28 01:07:21 +00:00
|
|
|
def self.const_missing c
|
|
|
|
r = /^#{c}/
|
2007-12-28 04:46:56 +00:00
|
|
|
t = constants.sort.find{|e|r=~e} and return const_get(t)
|
|
|
|
raise NameError, "uninitialized constant #{c}", caller(1)
|
2007-12-28 01:07:21 +00:00
|
|
|
end
|
|
|
|
|
2007-12-25 07:42:53 +00:00
|
|
|
def h(a='H', b='w', c='!')
|
|
|
|
puts "#{a}ello, #{b}orld#{c}"
|
|
|
|
end
|
2007-12-28 02:18:05 +00:00
|
|
|
|
|
|
|
def quine(src = $0)
|
2007-12-28 02:39:51 +00:00
|
|
|
SCRIPT_LINES__[src].join
|
2007-12-28 02:18:05 +00:00
|
|
|
end
|
2007-12-28 11:20:59 +00:00
|
|
|
|
|
|
|
alias say puts
|
2007-12-25 07:04:30 +00:00
|
|
|
end
|
2007-12-27 16:47:58 +00:00
|
|
|
|
|
|
|
class Integer
|
2007-12-28 04:59:00 +00:00
|
|
|
alias each times
|
2007-12-27 16:47:58 +00:00
|
|
|
include Enumerable
|
|
|
|
end
|
2007-12-30 14:49:22 +00:00
|
|
|
|
|
|
|
class String
|
|
|
|
alias / split
|
|
|
|
end
|