[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

multi-def docs?

YAD

9/6/2006 5:34:00 PM

I thought Ruby allows you to define similar functions in parallel by
putting the parts that differ together in square brackets. Is there
some online documentation for that? I haven't been able to find it yet.

--
Yet another Dan
13 Answers

e

9/6/2006 6:58:00 PM

0

YAD wrote:
> I thought Ruby allows you to define similar functions in parallel by
> putting the parts that differ together in square brackets. Is there
> some online documentation for that? I haven't been able to find it yet.

If you mean something like this:

some_method(arg1, arg2[, arg3[, arg4]]) => nil

It is just a documentation convention to indicate
optional arguments. In RDoc files this only appears
in methods defined in C because the call sequence
is entered manually in the doc rather than being
extracted from the code itself like with pure-Ruby.

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

Robert Klemme

9/6/2006 8:59:00 PM

0

YAD wrote:
> I thought Ruby allows you to define similar functions in parallel by
> putting the parts that differ together in square brackets. Is there
> some online documentation for that? I haven't been able to find it yet.

I have never heard of such a feature. This is certainly not in the core
language. Maybe some extension or framework? How do you think does the
syntax look like?

Kind regards

robert

Paul Lutus

9/7/2006 1:48:00 AM

0

YAD wrote:

> I thought Ruby allows you to define similar functions in parallel by
> putting the parts that differ together in square brackets. Is there
> some online documentation for that? I haven't been able to find it yet.

What follows is only approximately like what you are describing. Maybe it
will give you some ideas:

#!/usr/bin/ruby

class Demo
def initialize
@op_hash = {
"+" => Proc.new { |y,x| y + x },
"-" => Proc.new { |y,x| y - x },
"*" => Proc.new { |y,x| y * x },
"/" => Proc.new { |y,x| y / x }
}
end

def perform(y,x,m)
@op_hash[m].call(y,x)
end
end

demo = Demo.new

puts demo.perform(1.0,3.0,"/")

Output: 0.333333333333333

--
Paul Lutus
http://www.ara...

YAD

9/7/2006 4:56:00 PM

0

Robert Klemme wrote:
> I have never heard of such a feature.
Sorry. Must be another language.

Eero Saynatkari wrote:
> If you mean something like this:
> some_method(arg1, arg2[, arg3[, arg4]]) => nil
> It is just a documentation convention to indicate
> optional arguments.

No, it's something else.

Thanks for the help.

--
Yet another Dan

Ubiquitous

10/30/2011 4:04:00 PM

0

On Oct 29 2011 4:13 PM, suzeeq wrote:

> I think the OP meant - why wasn't it on Friday night? Nothing about the
> content of the show.

Friday? It was moved to Thursday, opposite Tom Cruise's show!

--
"If Barack Obama isn't careful, he will become the Jimmy Carter of the
21st century."

--------?


cloud dreamer

10/30/2011 4:54:00 PM

0

On 30/10/2011 3:21 PM, suzeeq wrote:
> Barry Margolin wrote:
>> In article <3590o8xl9c.ln2@app-01.ezprovider.com>,
>> "Ubiquitous" <weberm@polaris.net> wrote:
>>
>>> On Oct 29 2011 4:13 PM, suzeeq wrote:
>>>
>>>> I think the OP meant - why wasn't it on Friday night? Nothing about
>>>> the content of the show.
>>> Friday? It was moved to Thursday, opposite Tom Cruise's show!
>>
>> No it wasn't. Game 6 of the WS was on Thursday. The new episode of
>> Fringe was postponed to next week. That's what the commercial in the
>> link in the OP was about.
>>
>> What Tom Cruise show? This is the 2nd mention I've seen of it, but I
>> don't know what it refers to.
>
> I think it's Canadian TV? I've seen it mentioned before too, but don't
> know if it's a real show or just a joke.
>


Never heard of anything about Cruise up here.

..

--
We must change the way we live
Or the climate will do it for us

cloud dreamer

10/30/2011 5:01:00 PM

0

On 30/10/2011 3:26 PM, Dano wrote:
> "cloud dreamer" wrote in message
> news:sdudnRhAjcOuEjDTnZ2dnUVZ_qWdnZ2d@supernews.com...
>
> On 30/10/2011 3:21 PM, suzeeq wrote:
>> Barry Margolin wrote:
>>> In article <3590o8xl9c.ln2@app-01.ezprovider.com>,
>>> "Ubiquitous" <weberm@polaris.net> wrote:
>>>
>>>> On Oct 29 2011 4:13 PM, suzeeq wrote:
>>>>
>>>>> I think the OP meant - why wasn't it on Friday night? Nothing about
>>>>> the content of the show.
>>>> Friday? It was moved to Thursday, opposite Tom Cruise's show!
>>>
>>> No it wasn't. Game 6 of the WS was on Thursday. The new episode of
>>> Fringe was postponed to next week. That's what the commercial in the
>>> link in the OP was about.
>>>
>>> What Tom Cruise show? This is the 2nd mention I've seen of it, but I
>>> don't know what it refers to.
>>
>> I think it's Canadian TV? I've seen it mentioned before too, but don't
>> know if it's a real show or just a joke.
>>
>
>
> Never heard of anything about Cruise up here.
>
> =================================
>
> He's an American actor. Very short in real life I've heard. <g>


Heh.



..

--
We must change the way we live
Or the climate will do it for us

suzeeq

10/30/2011 5:22:00 PM

0

Ubiquitous wrote:
> On Oct 29 2011 4:13 PM, suzeeq wrote:
>
>> I think the OP meant - why wasn't it on Friday night? Nothing about the
>> content of the show.
>
> Friday? It was moved to Thursday, opposite Tom Cruise's show!

Must have been a rerun then, the next new episode won't be broadcast
until next week.

Barry Margolin

10/30/2011 5:23:00 PM

0

In article <3590o8xl9c.ln2@app-01.ezprovider.com>,
"Ubiquitous" <weberm@polaris.net> wrote:

> On Oct 29 2011 4:13 PM, suzeeq wrote:
>
> > I think the OP meant - why wasn't it on Friday night? Nothing about the
> > content of the show.
>
> Friday? It was moved to Thursday, opposite Tom Cruise's show!

No it wasn't. Game 6 of the WS was on Thursday. The new episode of
Fringe was postponed to next week. That's what the commercial in the
link in the OP was about.

What Tom Cruise show? This is the 2nd mention I've seen of it, but I
don't know what it refers to.

--
Barry Margolin
Arlington, MA

suzeeq

10/30/2011 5:51:00 PM

0

Barry Margolin wrote:
> In article <3590o8xl9c.ln2@app-01.ezprovider.com>,
> "Ubiquitous" <weberm@polaris.net> wrote:
>
>> On Oct 29 2011 4:13 PM, suzeeq wrote:
>>
>>> I think the OP meant - why wasn't it on Friday night? Nothing about the
>>> content of the show.
>> Friday? It was moved to Thursday, opposite Tom Cruise's show!
>
> No it wasn't. Game 6 of the WS was on Thursday. The new episode of
> Fringe was postponed to next week. That's what the commercial in the
> link in the OP was about.
>
> What Tom Cruise show? This is the 2nd mention I've seen of it, but I
> don't know what it refers to.

I think it's Canadian TV? I've seen it mentioned before too, but don't
know if it's a real show or just a joke.