summaryrefslogtreecommitdiff
path: root/golf_prelude.rb
blob: 602767a5de9232decaba75d0a5d7c7051b659dbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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

class Integer
  def each(&b)
    times &b
  end

  include Enumerable
end