[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Determining if initialize is defined in child class

Jim Freeze

7/12/2005 3:45:00 PM

Hi

I am looking for a method that will tell me if a method
is defined in a child class. The problem is when looking
at child classes for with the parent has the method in
question defined.

class C
private_method_defined?(:fred) #=> false
private_method_defined?(:initialize) #=> true
end

Is there some method that will return false for the above
initialize method:

class C
method_defined_in_this_class?(fred:) #=> false
method_defined_in_this_class?(:initialize) #=> false
def fred; end
method_defined_in_this_class?(fred:) #=> true
end

Ultimately I want to be able to do the following:

class Parent
def initialize; end
end

class Child < Parent
method_defined_in_this_class?(:initialize) #=> false
end

--
Jim Freeze


6 Answers

Eric Mahurin

7/12/2005 4:02:00 PM

0



--- Jim Freeze <jim@freeze.org> wrote:

> Hi
>
> I am looking for a method that will tell me if a method
> is defined in a child class. The problem is when looking
> at child classes for with the parent has the method in
> question defined.
>
> class C
> private_method_defined?(:fred) #=> false
> private_method_defined?(:initialize) #=> true
> end
>
> Is there some method that will return false for the above
> initialize method:
>
> class C
> method_defined_in_this_class?(fred:) #=> false
> method_defined_in_this_class?(:initialize) #=> false
> def fred; end
> method_defined_in_this_class?(fred:) #=> true
> end
>
> Ultimately I want to be able to do the following:
>
> class Parent
> def initialize; end
> end
>
> class Child < Parent
> method_defined_in_this_class?(:initialize) #=> false
> end


How about this:

private_instance_methods(false).include?("initialize")





____________________________________________________
Sell on Yahoo! Auctions ? no fees. Bid on great items.
http://auctions....


Jim Freeze

7/12/2005 4:31:00 PM

0

* Eric Mahurin <eric_mahurin@yahoo.com> [2005-07-13 01:01:36 +0900]:

> How about this:
>
> private_instance_methods(false).include?("initialize")

Ah, thanks. That's what I was looking for.

--
Jim Freeze


Dave \Crash\ Dummy

3/29/2012 12:08:00 AM

0

On Wed, 28 Mar 2012 19:27:31 -0300, Nashton <nana@na.ca> wrote:
>
>Oh definitely. And just watch everything escalate to the point that the
>criminals will acquire grenade launchers.
>
Good. That's all the excuse the Greeks need to round them up and send
them to the ovens. There are commentators on Greek TV that are openly
advocating for a "final solution" to the Third-World illegal migrant
problem, even including poison gas and crematoria. If the German
"technical experts" want to run the Greek economy, why not have them
do something *really* useful and supervise the "Kozani-witz" camp?
After all, they have experience. Where is Juergen Stroop now that we
need him? Put a sign over the gate that says, "Anaao?a Aeaoean?iae ."

BTW, as one TV commentator pointed out, if it costs a Bangladeshi
10,000 euros to be smuggled into Greece, where is he getting the
money? 10,000 euros in Bangladesh would make him a rich man, certainly
able to open a business. Something just doesn't add up here.

And further BTW, you wouldn't have to gas all one million migrants,
Gas a few, and the rest will flee for their lives! Problem solved!

gogu

3/29/2012 9:42:00 AM

0

? "Alexander Arnakis" <invalid@invalid.invalid> ?????? ??? ??????
news:en17n79allq6hq34gua6ul6927u7l9jrbr@4ax.com...
> On Wed, 28 Mar 2012 21:48:38 +0300, Mitsos <mitsos58@yahoo.com> wrote:
>>
>>A simple calculation shows that the human trafficking networks, mostly
>>run by Greeks but also by Albanians, Syrians, Egyptians and Nigerians,
>>make from 200,000 to 500,000 euros per day as ?slum lords.?


> The Greek police know who these "Fagins" are, but they don't arrest
> them. The logical conclusion is that the police are taking bribes to
> look the other way.
>
> The answer to the migration problem is mass deportation, beginning at
> the top, with those who expoit their fellow countrymen. No "detention
> centers," no asylum herings, no nothing. Put them on leaky ships and
> send them back to their origins. If the ships happen to not arrive at
> their destinations, who cares?
>
> In the meantime, the Karatzaferis proposal to arm Greeks in high-crime
> areas is a good one. If a drug-addled alien breaks into your apartment
> at 3 in the morning, shoot him!

REPULSIVE!
And you are calling yourself a...democrat!
You are REPULSIVE!
Period!

--

E' mai possibile, oh porco di un cane, che le avventure
in codesto reame debban risolversi tutte con grandi
puttane! F.d.A

Coins, travels and more:
http://s208.photobucket.com/albums/bb120...
http://gogu.enosi.org/...


Dave \Crash\ Dummy

3/29/2012 1:32:00 PM

0

On Thu, 29 Mar 2012 12:41:50 +0300, "gogu" <RuminiiSug@Pula.com>
wrote:

>I "Alexander Arnakis" <invalid@invalid.invalid> Yanaoa ooi i?ioia
>news:en17n79allq6hq34gua6ul6927u7l9jrbr@4ax.com...
>> On Wed, 28 Mar 2012 21:48:38 +0300, Mitsos <mitsos58@yahoo.com> wrote:
>>>
>>>A simple calculation shows that the human trafficking networks, mostly
>>>run by Greeks but also by Albanians, Syrians, Egyptians and Nigerians,
>>>make from 200,000 to 500,000 euros per day as ?slum lords.?
>
>
>> The Greek police know who these "Fagins" are, but they don't arrest
>> them. The logical conclusion is that the police are taking bribes to
>> look the other way.
>>
>> The answer to the migration problem is mass deportation, beginning at
>> the top, with those who expoit their fellow countrymen. No "detention
>> centers," no asylum hearings, no nothing. Put them on leaky ships and
>> send them back to their origins. If the ships happen to not arrive at
>> their destinations, who cares?
>>
>> In the meantime, the Karatzaferis proposal to arm Greeks in high-crime
>> areas is a good one. If a drug-addled alien breaks into your apartment
>> at 3 in the morning, shoot him!
>
>REPULSIVE!
>And you are calling yourself a...democrat!
>You are REPULSIVE!
>Period!

Are you saying the Greeks don't have the right to defend themselves?
THAT'S the idea that's repulsive!

gogu

3/29/2012 1:49:00 PM

0

Ï "Alexander Arnakis" <invalid@invalid.invalid> Ýãñáøå óôï ìÞíõìá
news:qvo8n7p25hkt0us391ign6tcj039iu0nt7@4ax.com...
> On Thu, 29 Mar 2012 12:41:50 +0300, "gogu" <RuminiiSug@Pula.com>
> wrote:
>
>>Ï "Alexander Arnakis" <invalid@invalid.invalid> Ýãñáøå óôï ìÞíõìá
>>news:en17n79allq6hq34gua6ul6927u7l9jrbr@4ax.com...
>>> On Wed, 28 Mar 2012 21:48:38 +0300, Mitsos <mitsos58@yahoo.com> wrote:
>>>>
>>>>A simple calculation shows that the human trafficking networks, mostly
>>>>run by Greeks but also by Albanians, Syrians, Egyptians and Nigerians,
>>>>make from 200,000 to 500,000 euros per day as µslum lords.¶
>>
>>
>>> The Greek police know who these "Fagins" are, but they don't arrest
>>> them. The logical conclusion is that the police are taking bribes to
>>> look the other way.
>>>
>>> The answer to the migration problem is mass deportation, beginning at
>>> the top, with those who expoit their fellow countrymen. No "detention
>>> centers," no asylum hearings, no nothing. Put them on leaky ships and
>>> send them back to their origins. If the ships happen to not arrive at
>>> their destinations, who cares?
>>>
>>> In the meantime, the Karatzaferis proposal to arm Greeks in high-crime
>>> areas is a good one. If a drug-addled alien breaks into your apartment
>>> at 3 in the morning, shoot him!


>>REPULSIVE!
>>And you are calling yourself a...democrat!
>>You are REPULSIVE!
>>Period!


> Are you saying the Greeks don't have the right to defend themselves?
> THAT'S the idea that's repulsive!


No, ***THAT'S*** repulsive:
"...Put them on leaky ships and
send them back to their origins. If the ships happen to not arrive at
their destinations, who cares?..."!!!!
This is a direct call for the assassination of people!
You are no better than the nazis!
You are REPULSIVE!
Period!


--

E' mai possibile, oh porco di un cane, che le avventure
in codesto reame debban risolversi tutte con grandi
puttane! F.d.A

Coins, travels and more:
http://s208.photobucket.com/albums/bb120...
http://gogu.enosi.org/...