[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Class.new ?

Warren Seltzer

1/25/2007 1:10:00 PM

The interpreter lets me make this mistake:

class Act
def Act.new
# Anything, really
end
end
######

Coding your own "new" just seems to screw things up. What is it good for and why isn't it a
syntax error?


Fred


7 Answers

WoNáDo

1/25/2007 2:11:00 PM

0

Warren Seltzer schrieb:
> The interpreter lets me make this mistake:
>
> class Act
> def Act.new
> # Anything, really
> end
> end
> ######
>
> Coding your own "new" just seems to screw things up. What is it good for and why isn't it a
> syntax error?
>
>
> Fred
>
>

You can write your own "new" method if it makes sense for your application. As I
understood it correctly, the initialization process uses three methods: "new",
"allocate", and "initialize".

>>>>> Code >>>>>

class Otto
def self.new(*p,&b)
puts "Here do something special..."
super(*p,&b)
end
def hi
puts "'Hi!' from an 'Otto' instance"
end
end
p Otto.new
Otto.new.hi

>>>>> Output >>>>>

Here do something special...
#<Otto:0x2aeb148>
Here do something special...
'Hi!' from an 'Otto' instance

>>>>> EoE >>>>>

Wolfgang Nádasi-Donner

David Johnston

4/14/2012 2:51:00 AM

0

On 4/13/2012 9:23 AM, Arthur Lipscomb wrote:

> Law and Order:SVU (recorded) - Already discussed. I wonder if they
> expect the audience to believe that in all the years this show has been
> on, that's the one and only innocent person that was sent away. Given
> the real criminal's distinctive methods, seeing as how he never bothered
> to change it, how did it take so long for someone to notice the pattern.

The fact that each crime took place in a different country tends to
reduce the chance that anyone will have enough information.

Tony Calguire

4/14/2012 8:29:00 AM

0

Arthur Lipscomb <arthur@alum.calberkeley.org> wrote in
news:jm9gd3$m18$1@dont-email.me:

>
> It seemed OK to me. And there were more direct clues that his world
> isn't what it seems to be. The captain/conspiracy seems to be taking
> place in the red world. Has there been any signs of either one in the
> green world?
>

I find it interesting reading these threads how different people experience
the phenomenon of "color temperature". For me, ever since I was a little
kid, it's always been brown and blue. But I see a lot of people going with
red and green. Do I dare ask any of you what color a school bus is? :-)

Mason Barge

4/14/2012 4:19:00 PM

0

On Sat, 14 Apr 2012 08:29:16 +0000 (UTC), Tony Calguire
<calguire@tcfreenet.invalid> wrote:

>Arthur Lipscomb <arthur@alum.calberkeley.org> wrote in
>news:jm9gd3$m18$1@dont-email.me:
>
>>
>> It seemed OK to me. And there were more direct clues that his world
>> isn't what it seems to be. The captain/conspiracy seems to be taking
>> place in the red world. Has there been any signs of either one in the
>> green world?
>>
>
>I find it interesting reading these threads how different people experience
>the phenomenon of "color temperature". For me, ever since I was a little
>kid, it's always been brown and blue. But I see a lot of people going with
>red and green. Do I dare ask any of you what color a school bus is? :-)

Well, first off, Michael wears a red rubber band in one world and a green
rubber band in the other; I think most people take the names from these.

As far as what kinds of filters they use to change the termperature --
well, brown is not really a color in color theory, LOL. It's a
desaturated orange. (They do saturate the browns more in the "red" world
by removing some blue.)

The difficulty lies in dividing a system with three axes into two parts.
If you are used to using a light-based color system (RGB) then blue is the
maximum "cool" color, and green is actually half of the maximum "warm"
color, bright orange. Of course, these are adjusted for nature. So using
the actual colors your television screen uses, it should be blue world and
red-green world.

Also, the blue-green world has generally less saturation overall than the
red world, which tends to make it "cooler" and less vibrant.

(Don't ask a printer about this. He'll tell you cyan is the target cool
color and magenta and yellow are warm.)

But all that being said, if you want to call the worlds blue and brown,
it's pretty close and a lot closer than red and green. Technically, the
poles towards which the colors trend are blue and orange. But again, I
think most people identify them by the rubber bands.

Tony Calguire

4/15/2012 3:47:00 AM

0

Mason Barge <masonbarge@gmail.com> wrote in
news:kf7jo75vu0ejbulqot1e6o5afb5ve8c8sl@4ax.com:

>
> Well, first off, Michael wears a red rubber band in one world and a
> green rubber band in the other; I think most people take the names
> from these.
>

D'oh! The wristbands. I hadn't even considered those. Of course that's
why people are saying red and green.

Honestly, I think it's easier just to say "Wife's world" and "Son's world".


>
> But all that being said, if you want to call the worlds blue and
> brown, it's pretty close and a lot closer than red and green.
> Technically, the poles towards which the colors trend are blue and
> orange. But again, I think most people identify them by the rubber
> bands.
>

I've always been a bit fascinated by color temperature on television
because it was something I noticed at a very young age but never had any
concept of what or why it was, and I didn't really have a vocabulary to
even describe it. I was finally able to figure it out as a teenager, when
the first season of Newhart was shot on video tape-- very warm-- and the
remaining seasons were shot on film-- much cooler.

suzeeq

4/15/2012 4:13:00 AM

0

Tony Calguire wrote:
> Mason Barge <masonbarge@gmail.com> wrote in
> news:kf7jo75vu0ejbulqot1e6o5afb5ve8c8sl@4ax.com:
>
>> Well, first off, Michael wears a red rubber band in one world and a
>> green rubber band in the other; I think most people take the names
>> from these.
>>
>
> D'oh! The wristbands. I hadn't even considered those. Of course that's
> why people are saying red and green.

I thought they were talking about the 'shade' of each world. I never
even notice the wristbands.

> Honestly, I think it's easier just to say "Wife's world" and "Son's world".

Or something.

>
>> But all that being said, if you want to call the worlds blue and
>> brown, it's pretty close and a lot closer than red and green.
>> Technically, the poles towards which the colors trend are blue and
>> orange. But again, I think most people identify them by the rubber
>> bands.
>>
>
> I've always been a bit fascinated by color temperature on television
> because it was something I noticed at a very young age but never had any
> concept of what or why it was, and I didn't really have a vocabulary to
> even describe it. I was finally able to figure it out as a teenager, when
> the first season of Newhart was shot on video tape-- very warm-- and the
> remaining seasons were shot on film-- much cooler.

I don't see a lot of difference that way. Crisper or softer yes, but not
warm or cool colors.

MDuPree

4/21/2012 4:15:00 PM

0

Arthur Lipscomb <arthur@alum.calberkeley.org> writes:

> On 4/13/2012 5:03 AM, Obveeus wrote:

>> AWAKE: The A-plot was about vaginal tearing and took about all of
>> 0.25 seconds to deduce the perpetrator of the crime. The B-plot was
>> about a devil with a newly formed heart of gold and was much less
>> compelling than the A-plot. Meanwhile, there was more 'smoke
>> monster' level crap with the conspiracy arc going nowhere. Worst
>> episode of the series so far.
>
> It seemed OK to me.

And to me.

> And there were more direct clues that his world isn't what it seems to
> be. The captain/conspiracy seems to be taking place in the red world.
> Has there been any signs of either one in the green world?

The captain is in both worlds, but I've seen no signs of the conspiracy
in the green world so far.

-Micky