1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/golf_prelude.rb
usa eadfbddd93 * golf_prelude.rb (h): add new method for all golfers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 07:42:53 +00:00

11 lines
231 B
Ruby

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
def h(a='H', b='w', c='!')
puts "#{a}ello, #{b}orld#{c}"
end
end