1  >> $:.grep(%r{/gems/([^/]+-[0-9\.]+)/lib$}){$1}
   2  => ["addressable-2.0.2", "merb-auth-slice-password-1.0.8.1", "json-1.1.4.1", "extlib-0.9.10", ...

posted by Png maiha on Wed 11 Feb 2009 at 17:33

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.

   1  require 'rubygems'
   2  require 'methopara'
   3  
   4  class Foo
   5    def foo(a,b) end
   6  end
   7  Foo.instance_method(:foo).parameters
   8  #=> [[:req, :a], [:req, :b]]

Enjoy!

posted by Png takiuchi on Wed 11 Feb 2009 at 16:26

Yesterday (Feb 10, 2009), asakusa.rb took place at Akihabara, Tokyo. asakusa.rb is a rubyist community that is based on Asakusa.

In the monthly meet-up of that community, @ko1_twitter wrote a code snippet. This snippet is a kind of backport of Method#parameters for Ruby-1.9.1. His quick job led a way for merbists to change merb to be corresponding to Ruby-1.9.1. He named his work "methopara". It stands for METHOd PARAmeters.

And I made it as a gem for ease of use. Now we can use it by the command below.

   1  % sudo gem install methopara --source http://merbi.st

Usage is as follows.

   1  >> require "rubygems"
   2  >> require "methopara"
   3  >> def foo(a,b=nil,&c) end
   4  >> method(:foo).parameters
   5  => [[:req, :a], [:opt, :b], [:block, :c]]

This gem is only for Ruby-1.9.1. Because Ruby18x have merb-action-args, and Ruby-1.9.2 and its successors will have built-in Method#parameters.

Enjoy!

See Also

posted by Png genki on Wed 11 Feb 2009 at 10:35 with 1 comment
Contents
how to list up active gem names
methopara-0.3.0 Released
methopara: Method#parameters only for Ruby-1.9.1
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ