• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

methopara
is a gem that enables us to use Method#parameters with Ruby-1.9.1.
It was originally made by @ko1_twitter, the creater of YARV, at the previous meet-up of asakusa.rb.

And this time, I added an interface to use it for UnboundMethod.
Now you can use UnboundMethod#parameters with new methopara, like this.

ruby>>
require 'rubygems'
require 'methopara'

class Foo
def foo(a,b) end
end
Foo.instance_method(:foo).parameters
#=> [[:req, :a], [:req, :b]]
<<--

Enjoy!

posted by takiuchi takiuchi on Wed 11 Feb 2009 at 16:18 with 0 comments