On Nov 21, 2011, at 8:26 PM, Robert Klemme wrote:

> 2011/11/21 Jes=FAs Gabriel y Gal=E1n <jgabrielygalan / gmail.com>:
>> On Mon, Nov 21, 2011 at 6:55 PM, hari mahesh <harismahesh / gmail.com> =
wrote:
>>> Consider I have a ruby file called library.rb.
>>>=20
>>> In which i defined a function like this :
>>>=20
>>> def Name(testcase, result)
>>> pdf =3D PDF::Writer.new
>>> testcase=3D $testcase
>>> pdf.text $testcase, :font_size =3D> 72, :justification =3D> :center
>>> result=3D $result
>>> pdf.text $result, :font_size =3D> 72, :justification =3D> :center
>>> end
>>>=20
>>> now i have another ruby file named web.rb which calls thus =
library.rb.
>>>=20
>>> My Problem is I need to pass these arguments separately.
>>>=20
>>> Means , I need to call Testcase argument firstly and then after many
>>> conditions I need to pass result as Pass or fail.
>>>=20

If I understand that correctly, what you're looking for is actually =
textbook partial application or currying/sch=F6nfinkeling. If you're =
using Ruby 1.9 you can use Proc#curry directly like so:

# unbind the method and convert it to Proc to use #curry
report =3D method(:Name).to_proc.curry[testcase]

# and later apply the second argument
report[result]

Alternatively, you can also implement partial application like this:

# define a lambda that that captures your test case in a closure so you =
can pass the result later
report =3D lambda { |result| Name(testcase, result) }

# later, execute the lambda with your result
report[result]

Note that in your case it is probably better to follow the advice posted =
by Jesus and Robert for a cleaner solution. It's just that functional =
programming is fun, and your question really seemed to call for partial =
application!

Sylvester