[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Marshal/Serialization Question

Bryan Richardson

8/19/2008 9:39:00 PM

Hello all,

I'm trying to Marshal some Ruby objects to file and I have a question
about parent classes. Say I have the following:

class Device
@@id = 0
@@id_map = Hash.new
@@device_map = Hash.new

def initialize(*args)
id = @@id += 1
@@id_map[self] = id
@@device_map[id] = self
end

def self.id(device)
return @@id_map[device]
end

def self.device(id)
return @@device_map[id]
end
end

class Foo < Device
def initialize
super
end
end

Now, if I create a Foo class, dump it to file and then load it again
using Marshal, should I be able to use the id and device methods in the
parent class or will the class variables not be dumped and loaded?

--
Thanks!
Bryan
--
Posted via http://www.ruby-....

65 Answers

Robert Klemme

8/20/2008 5:25:00 AM

0

On 19.08.2008 23:38, Bryan Richardson wrote:
> Hello all,
>
> I'm trying to Marshal some Ruby objects to file and I have a question
> about parent classes. Say I have the following:
>
> class Device
> @@id = 0
> @@id_map = Hash.new
> @@device_map = Hash.new
>
> def initialize(*args)
> id = @@id += 1
> @@id_map[self] = id
> @@device_map[id] = self
> end
>
> def self.id(device)
> return @@id_map[device]
> end
>
> def self.device(id)
> return @@device_map[id]
> end
> end
>
> class Foo < Device
> def initialize
> super
> end
> end
>
> Now, if I create a Foo class, dump it to file and then load it again
> using Marshal, should I be able to use the id and device methods in the
> parent class or will the class variables not be dumped and loaded?

Try it out. I'd say, most likely they are not dumped as classes are not
serialized IIRC. Class variables are evil anyway... :-)

Kind regards

robert

Al

8/11/2012 9:04:00 PM

0

In article
<080f52c8-2656-406f-b81a-40fa7e83aaa5@a17g2000yqg.googlegroups.com>,
"Ramon F. Herrera" <ramon@conexus.net> wrote:

> Reporter Ramon: "Rep. Ryan, since you are a Catholic, what do you
> think about the position of the Catholic church (ALL churches in
> America, actually) on immigration?"
>
> Ryan: (weaseling out) "I will not allow my church to dictate my
> policies, I am only interested in the economics aspect"

That would seem to be a clear statement of separating religion and
government and his position.

So, what's the problem?

Al

8/11/2012 9:16:00 PM

0

In article <k05p6r$alb$1@dont-email.me>, "Sid9" <sid9@ bellsouth.net>
wrote:

> "Ramon F. Herrera" <ramon@conexus.net> wrote in message
> news:080f52c8-2656-406f-b81a-40fa7e83aaa5@a17g2000yqg.googlegroups.com...
> >
> > Reporter Ramon: "Rep. Ryan, since you are a Catholic, what do you
> > think about the position of the Catholic church (ALL churches in
> > America, actually) on immigration?"
> >
> > Ryan: (weaseling out) "I will not allow my church to dictate my
> > policies, I am only interested in the economics aspect"
> >
> > Ramon: "Oh, I am glad you are a fellow believer in Free Enterprise
> > (long live!)... What do you think about the position of the US Chamber
> > of Commerce (ALL US businesses, actually) on immigration?"
> >
> > Ryan: Mumbled something and was whisked to his new limo.
> >
> > -Ramon
> > Proud Member of the US Chamber of Commerce (regular and Hispanic)
> > So quit calling me commie, will ya'?
> > 100% Supporter of the position on immigration being
> > lobbied and led by The US Chamber of Commerce
> .
> .
> .
>
> Paul Ryan's book of faith was written by Ayn Rand.

Biden's was written by by the staff of Sarurday Night Live.

Yoorghis

8/11/2012 9:29:00 PM

0

On Sat, 11 Aug 2012 16:04:25 -0500, Al <albert.finney000@gmail.com>
wrote:

>In article
><080f52c8-2656-406f-b81a-40fa7e83aaa5@a17g2000yqg.googlegroups.com>,
> "Ramon F. Herrera" <ramon@conexus.net> wrote:
>
>> Reporter Ramon: "Rep. Ryan, since you are a Catholic, what do you
>> think about the position of the Catholic church (ALL churches in
>> America, actually) on immigration?"
>>
>> Ryan: (weaseling out) "I will not allow my church to dictate my
>> policies, I am only interested in the economics aspect"
>
>That would seem to be a clear statement of separating religion and
>government and his position.
>
>So, what's the problem?

Because the party platform doesn't conform to his personal beliefs.

Read his statement carefully.

Bye Bye Glove

8/11/2012 9:32:00 PM

0

On 8/11/2012 3:16 PM, Al wrote:
> In article<k05p6r$alb$1@dont-email.me>, "Sid9"<sid9@ bellsouth.net>
> wrote:
>
>> "Ramon F. Herrera"<ramon@conexus.net> wrote in message
>> news:080f52c8-2656-406f-b81a-40fa7e83aaa5@a17g2000yqg.googlegroups.com...
>>>
>>> Reporter Ramon: "Rep. Ryan, since you are a Catholic, what do you
>>> think about the position of the Catholic church (ALL churches in
>>> America, actually) on immigration?"
>>>
>>> Ryan: (weaseling out) "I will not allow my church to dictate my
>>> policies, I am only interested in the economics aspect"
>>>
>>> Ramon: "Oh, I am glad you are a fellow believer in Free Enterprise
>>> (long live!)... What do you think about the position of the US Chamber
>>> of Commerce (ALL US businesses, actually) on immigration?"
>>>
>>> Ryan: Mumbled something and was whisked to his new limo.
>>>
>>> -Ramon
>>> Proud Member of the US Chamber of Commerce (regular and Hispanic)
>>> So quit calling me commie, will ya'?
>>> 100% Supporter of the position on immigration being
>>> lobbied and led by The US Chamber of Commerce
>> .
>> .
>> .
>>
>> Paul Ryan's book of faith was written by Ayn Rand.
>
> Biden's was written by by the staff of Sarurday Night Live.


<GUFFAW!>

Ramon F Herrera

8/11/2012 9:32:00 PM

0

On Aug 11, 4:04 pm, Al <albert.finney...@gmail.com> wrote:
> In article
> <080f52c8-2656-406f-b81a-40fa7e83a...@a17g2000yqg.googlegroups.com>,
>  "Ramon F. Herrera" <ra...@conexus.net> wrote:
>
> > Reporter Ramon: "Rep. Ryan, since you are a Catholic, what do you
> > think about the position of the Catholic church (ALL churches in
> > America, actually) on immigration?"
>
> > Ryan: (weaseling out) "I will not allow my church to dictate my
> > policies, I am only interested in the economics aspect"
>

> That would seem to be a clear statement of separating
> religion and government and his position.
>
> So, what's the problem?

The problem is that you are not clear on the separation of church and
state.

- When Nancy Reagan uses an Ouija board to consult with some god and
decide on US policy, the separation applies.

- If it is suggested that sacred wine must be drank before the
National Security Council meets, the separation applies.

- In the ObamaCare contraception, there is a border that should be
delineated.

THOSE are examples of issues where the separation doctrine applies.

However, when representatives from ALL churches make POLITICAL demands
and statements about immigration, those expressions of democracy are
VALID and deserve consideration.

NOBODY from your side has tried to discredit the religious leaders
below. It is in their job description to be on the side of compassion,
against hatred.

-Ramon

-------------------------------------

http://www.cnn.com/2010/POLITICS/06/09/evangelicals.immigrati...
http://www.justiceforimmigrants.org/whats...
http://archive.episcopalchurch.org/81803_123594_E...
http://latino.foxnews.com/latino/politics/2011/01/08/conservatives-launch-movement-demanding-immigrati...
http://www.nytimes.com/2010/07/19/us/politics/19evangel...
http://www.washingtonpost.com/wp-dyn/content/article/2010/03/20/AR20100320...
http://religion.blogs.cnn.com/2011/11/13/latino-evangelicals-challenge-alabama-brethren-on-im...
http://www.aila.org/content/default.as...|25669|19898|18690|21557|20084

This is my favorite:

http://www.chron.com/disp/story.mpl/metropolitan/74...

(notice the fear in the face of the good Monsignor, who remembers how
his Italian ancestors were persecuted, looking out for La Migra
agents, as he tightly carries his papers "in pectore")

http://en.wikipedia.org/wiki/...

Bye Bye Glove

8/11/2012 9:35:00 PM

0

On 8/11/2012 3:28 PM, Yoorghis@Jurgis.net wrote:
> Read his statement carefully.

Get your worthless racist ass out of here, Mt. Rushmore terrorist:


BWAAAHAHAHAHHAHAHAHAHAHAHA

The Amazing Usenet Intellect Of HUD subsidized, 70-year old, Rapid City, SD=
moron Gary 'Yoorg' Roselles:0

"She should be at least shot" -- Gary Roselles calling for the shooting dea=
th of duly elected US government official Katherine Harris0

"I call Kathering Harris a nazi/fascist right wing ideologue whore. What di=
dwe do to German nazis right wing whores?" -- Roselles clearly states
his m=
otive for gunning down Katherine Harris in cold-blood0

"I consider hating RIGHT WING nazi/fascist fucks like

you a God inspired em=
otion." -- Sociopath Roselles enters Charles Manson territory as he
claims =
his foam-flecked hatred and calls to murder are divinely 'inspired'0

"Hating RIGHT WINGERS is doing God's work, Dumbapropyl." -- More Manson-lik=
e megalomania from usenet sociopath Gary Roselles0

"Who gives a shit what these nuts (religious groups) want or don't want -- =
KORESH THEM ALL" -- Psychopath Gary Roselles calls for widespread
fiery dea=
ths of US Religious Groups by the ATF.0

"May a real american have the honor of putting a bullet between her eyes." =
-- Gary Roselles calls for the brutal shooting death of Rob
Robertson's tee=
nage daughter.0

"Go Ahead and put his face there. I ain't blowed a mountain up today. I can=
make it (blowing up Mt. Rushmore) look like a mining accident" --
Ex-miner=
<chuckle> and Rapid City resident Gary Roselles threatens to blow up
Mt. R=
ushmore.0

"Hinckley TRIED to do a good thing" -- Gary Roselles praises would-be presi=
dential assassin John Hinckley0

"That slut Barbara Olsen (9/11 victim) is dead? GOOD!" On 12 Sept 2001 08:4=
2:54 GMT Gary Roselles <rosell19@idt...> wrote. That's right folks --
soci=
opath Gary Roselles really did gloat about the 9/11 death of fellow
citizen=
Barbara Olsen ON SEPTEMBER TWELFTH!!!0

"God turned Olsen into jelly" -- Psychopath Gary Roselles says "God killed"=
US 9/11 victim Barbara Olsen0

"Then why was you mother stupid enough to fuck all them black guys?" - Gary=
'yoorg' Roselles, racist prick0

What the fuck would a dumb cocksucker like (Distinguished African- American=
Scholar, Thomas) Sowell, who sits out at Stanford, never having 208w=
orked a day in his Uncle Tom life, know anything?" -- Gary Roselles0

"Both are traitors to their race" -- Race Purist Gary Roselles 208di=
scusses209 African-American Dr.209s Thomas Sowell, Walter Willi=
ams and the importance of Race Loyalty0

"You actually think that placing blackskinned, white thinking people is goi=
ng to gain anything with real minorities?" -- Gary Roselles, Racist0

"Them brown niggers need to be taken out" -- Gary Roselles, Racist0

"He (African-American scholar Thomas Sowell) goes against his own kind." Ra=
ce loyalist Gary Roselles, insisting once again that 20Cthem blacks=
20D should "stick 208to their own kind"0

"His appointment will bridge nothing. It's apparant he's being an uncle to=
m to appease voters." -- White trash, racist asshole Gary Roselles 20=
8slurs African-American Hero General Colin Powell0

"Group Negro Poster Pyjamarma admits to being a coconut headed coon" -- Gar=
y Roselles, pathetic racist0

"Say "yes Massa", Uncle Tom." 203 Vile racist Gary Roselles pathetica=
lly mocks and 208slurs prominent African-American man-of-the-cloth Je=
sse Lee Peterson0

"How does a pampered, Stanford based, Scaife funded, Uncle Tom make judgeme=
nts on "the bottom", McFly?" -- Another day, another racial slur on an
educ=
ated, successful, independent black man from Gary Roselles0

"Nope, Don't have to hire blacks" -- Gary Roselles, Racist Prick0

"Che (Guevara) was a conservative ideologue" - Gary Roselles0

"Marx and Engels were RIGHT-WINGERS you dumb cocksucker" -- Gary Roselles=
0

"The United States is obligated to follow the DEMOCRATIC rule of the UN" --=
Gary Roselles0

"The Soviet Union should've kept Afghanistan" -- Gary Roselles0

Ramon F Herrera

8/11/2012 9:40:00 PM

0

On Aug 11, 4:16 pm, Al <albert.finney...@gmail.com> wrote:

> Biden's was written by by the staff of Saturday Night Live.

Says the man from the party that brought to us the likes of Dan
Quayle, George Bush, Sarah Palin, Christine O'Donnell, Sharon Angle,
Alan West, Rick Santorum, Issa, Jan Brewer...

-Ramon

Al

8/11/2012 9:51:00 PM

0

In article <3jjd281gbfglek6344vefbd26g7dupom2u@4ax.com>,
Yoorghis@Jurgis.net wrote:

> On Sat, 11 Aug 2012 16:04:25 -0500, Al <albert.finney000@gmail.com>
> wrote:
>
> >In article
> ><080f52c8-2656-406f-b81a-40fa7e83aaa5@a17g2000yqg.googlegroups.com>,
> > "Ramon F. Herrera" <ramon@conexus.net> wrote:
> >
> >> Reporter Ramon: "Rep. Ryan, since you are a Catholic, what do you
> >> think about the position of the Catholic church (ALL churches in
> >> America, actually) on immigration?"
> >>
> >> Ryan: (weaseling out) "I will not allow my church to dictate my
> >> policies, I am only interested in the economics aspect"
> >
> >That would seem to be a clear statement of separating religion and
> >government and his position.
> >
> >So, what's the problem?
>
> Because the party platform doesn't conform to his personal beliefs.

In what way?


> Read his statement carefully.

"I will not allow my church to dictate my policies"

Seems pretty clear.

Al

8/11/2012 9:52:00 PM

0

In article
<4dd34d06-7014-4839-bfba-3d9a666b4420@i11g2000yqf.googlegroups.com>,
Ramon F Herrera <goposter@jonjay.com> wrote:

> On Aug 11, 4:04?pm, Al <albert.finney...@gmail.com> wrote:
> > In article
> > <080f52c8-2656-406f-b81a-40fa7e83a...@a17g2000yqg.googlegroups.com>,
> > ?"Ramon F. Herrera" <ra...@conexus.net> wrote:
> >
> > > Reporter Ramon: "Rep. Ryan, since you are a Catholic, what do you
> > > think about the position of the Catholic church (ALL churches in
> > > America, actually) on immigration?"
> >
> > > Ryan: (weaseling out) "I will not allow my church to dictate my
> > > policies, I am only interested in the economics aspect"
> >
>
> > That would seem to be a clear statement of separating
> > religion and government and his position.
> >
> > So, what's the problem?
>
> The problem is that you are not clear on the separation of church and
> state.


I am not running for office.

<I'm not interested in your canned propaganda, snip>