[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Proc params extension

Yukihiro Matsumoto

1/16/2009 1:58:00 AM

Hi,

In message "Re: Proc params extension"
on Fri, 16 Jan 2009 09:27:04 +0900, Tj Holowaychuk <tj@vision-media.ca> writes:
|
|Basically what I need is:
|
|Proc.new { |a,b,c| }.params # => [:a, :b, :c]

1.9 has Proc#parameters:

Proc.new { |a,b,c| }.parameters
# => [[:opt, :a, nil], [:opt, :b, nil], [:opt, :c, nil]]

which means all a, b, c are optional, and their default values are
nil.

matz.

2 Answers

Tj Holowaychuk

1/16/2009 2:10:00 AM

0

Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: Proc params extension"
> on Fri, 16 Jan 2009 09:27:04 +0900, Tj Holowaychuk
> <tj@vision-media.ca> writes:
> |
> |Basically what I need is:
> |
> |Proc.new { |a,b,c| }.params # => [:a, :b, :c]
>
> 1.9 has Proc#parameters:
>
> Proc.new { |a,b,c| }.parameters
> # => [[:opt, :a, nil], [:opt, :b, nil], [:opt, :c, nil]]
>
> which means all a, b, c are optional, and their default values are
> nil.
>
> matz.

perfect! that tree would be fantastic, would it be reasonably possible
to backport as a gem extension? Im not sure what would be involved, or
if to many changes would have to be made.

Thanks matz
--
Posted via http://www.ruby-....

Tj Holowaychuk

1/16/2009 2:20:00 AM

0

ps. I know you get this all the time, but thanks for Ruby man! I have
only been using it for about 2 or 3 months, but I love it, has changed
my perspective on programming thats for sure. Nice to actually enjoy
what I do again :)
--
Posted via http://www.ruby-....