[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Trouble with module/class inheritance

James Byrne

4/22/2009 2:32:00 PM

I have a class "ForexCASource" that does this:

class ForexCASource
include Nokogiri::XML

def initializer(...
...
return xchg_source
end

# Takes an xml source, default set to FOREX_SITE
# Returns a nokogiri xml document object
def xchg_source(source=FOREX_SITE)
@forex_doc = Nokogiri::XML(open(source))
rescue Exception => e
puts e
Rails::logger.error("ForexCASource unable to read #{source} \n
#{e}")
raise e
end
...

When new is called on this class (fx_xml_doc = ForexCASource.new) then I
expect to receive @forex_doc, which has a class of
"Nokogiri::XML::Document", and an inherited public method '#xpath'.

However, while the returned object has class ForexCASource, which is to
be expected, I do not get the #xpath method attached to the returned
object, which is not what I expected.

When I examine the returned object then I see:

puts fx_xml_doc.class.ancestors
ForexCASource
Nokogiri::XML
Object

This is critically different than "Nokogiri::XML::Document". What
changes the ancestor of @forex_doc from Nokogiri::XML::Document to
Nokogiri::XML and removes the #xpath method? What is it about
inheritance/mixin am I not understanding?
--
Posted via http://www.ruby-....

10 Answers

James Byrne

4/22/2009 2:41:00 PM

0

James Byrne wrote:

>
> This is critically different than "Nokogiri::XML::Document". What
> changes the ancestor of @forex_doc from Nokogiri::XML::Document to
> Nokogiri::XML and removes the #xpath method? What is it about
> inheritance/mixin am I not understanding?

I implemented my own xpath method which calls
Nokogiri::XML::Document.xpath on the internal instance variable
@forex_doc. This has resolved my problem.
--
Posted via http://www.ruby-....

Tim

10/16/2011 5:23:00 AM

0

On Oct 15, 9:11 pm, Donna <tom.r...@ix.netcom.com> wrote:
> On Oct 15, 11:58 pm, Stephen  X. Carter <steve@[127.0.0.1]> wrote:
>
> > And.  Liek just about everyone else in the UK I listened in to the Kenny
> > Everett show when he played Sgt. Pepper for the first time. Warm summer
> > day, everywhere people had their radio on, windows open, listening.
> > Magical.
>
> > (The BBC still have a copy of that entire broadcast, which they play
> > from time to time).
>
> Being from the US, I didn't know about this broadcast, Stephen, but I
> think I found it on youtube, and I'm listening to it now.  Here's the
> first part:
>
> http://www.youtube.com/watch?v=5...

My very first memory was listening to She Loves You and I Wanna Hold
Your Hand on a 45 rmp record version that a neighbor friend had
gotten his hands on,, shortly before The Beatles became NYC bound.
That memory still makes me feel elation upon the remembrance of
repeatedly playing it,

JohnB

10/16/2011 2:52:00 PM

0

On Oct 16, 6:22 am, Tim <tdwilliams...@sbcglobal.net> wrote:
> On Oct 15, 9:11 pm, Donna <tom.r...@ix.netcom.com> wrote:
>
> > On Oct 15, 11:58 pm, Stephen  X. Carter <steve@[127.0.0.1]> wrote:
>
> > > And.  Liek just about everyone else in the UK I listened in to the Kenny
> > > Everett show when he played Sgt. Pepper for the first time. Warm summer
> > > day, everywhere people had their radio on, windows open, listening.
> > > Magical.
>
> > > (The BBC still have a copy of that entire broadcast, which they play
> > > from time to time).
>
> > Being from the US, I didn't know about this broadcast, Stephen, but I
> > think I found it on youtube, and I'm listening to it now.  Here's the
> > first part:
>
> >http://www.youtube.com/watch?v=5...
>
> My very first memory was listening to She Loves You and I Wanna Hold
> Your Hand on a 45 rmp record version that  a neighbor friend had
> gotten his hands on,, shortly before The Beatles became NYC bound.
> That memory still makes me feel elation upon the remembrance of
> repeatedly playing it,

First memory, hazy now it was so long ago, hearing Twist And Shout on
the radio. I'd have been eight, going on nine. I was the most exciting
sound I'd ever heard and from then on I couldn't wait to hear more and
more Beatles records. From Me To You and She Loves You followed soon
after to justify my excitement - but we had to rely on the radio as it
was several years before we had our own record player.

Tim

10/16/2011 7:21:00 PM

0

On Oct 16, 7:51 am, JohnB <johnbo...@tinyworld.co.uk> wrote:
> On Oct 16, 6:22 am, Tim <tdwilliams...@sbcglobal.net> wrote:
>
>
>
>
>
>
>
>
>
> > On Oct 15, 9:11 pm, Donna <tom.r...@ix.netcom.com> wrote:
>
> > > On Oct 15, 11:58 pm, Stephen  X. Carter <steve@[127.0.0.1]> wrote:
>
> > > > And.  Liek just about everyone else in the UK I listened in to the Kenny
> > > > Everett show when he played Sgt. Pepper for the first time. Warm summer
> > > > day, everywhere people had their radio on, windows open, listening.
> > > > Magical.
>
> > > > (The BBC still have a copy of that entire broadcast, which they play
> > > > from time to time).
>
> > > Being from the US, I didn't know about this broadcast, Stephen, but I
> > > think I found it on youtube, and I'm listening to it now.  Here's the
> > > first part:
>
> > >http://www.youtube.com/watch?v=5...
>
> > My very first memory was listening to She Loves You and I Wanna Hold
> > Your Hand on a 45 rmp record version that  a neighbor friend had
> > gotten his hands on,, shortly before The Beatles became NYC bound.
> > That memory still makes me feel elation upon the remembrance of
> > repeatedly playing it,
>
> First memory, hazy now it was so long ago, hearing Twist And Shout on
> the radio. I'd have been eight, going on nine. I was the most exciting
> sound I'd ever heard and from then on I couldn't wait to hear more and
> more Beatles records. From Me To You and She Loves You followed soon
> after to justify my excitement - but we had to rely on the radio as it
> was several years before we had our own record player.

That's what makes it a problem for 2nd-3rd generation Beatles fans:We
had the luxury to wait and see chronologically, what was to come next,
album by album, while later fans often get song/album release timings
mixed up.

marcus

10/16/2011 8:42:00 PM

0

On Oct 16, 3:20 pm, Tim <tdwilliams...@sbcglobal.net> wrote:
> On Oct 16, 7:51 am, JohnB <johnbo...@tinyworld.co.uk> wrote:
>
>
>
>
>
> > On Oct 16, 6:22 am, Tim <tdwilliams...@sbcglobal.net> wrote:
>
> > > On Oct 15, 9:11 pm, Donna <tom.r...@ix.netcom.com> wrote:
>
> > > > On Oct 15, 11:58 pm, Stephen  X. Carter <steve@[127.0.0.1]> wrote:
>
> > > > > And.  Liek just about everyone else in the UK I listened in to the Kenny
> > > > > Everett show when he played Sgt. Pepper for the first time. Warm summer
> > > > > day, everywhere people had their radio on, windows open, listening.
> > > > > Magical.
>
> > > > > (The BBC still have a copy of that entire broadcast, which they play
> > > > > from time to time).
>
> > > > Being from the US, I didn't know about this broadcast, Stephen, but I
> > > > think I found it on youtube, and I'm listening to it now.  Here's the
> > > > first part:
>
> > > >http://www.youtube.com/watch?v=5...
>
> > > My very first memory was listening to She Loves You and I Wanna Hold
> > > Your Hand on a 45 rmp record version that  a neighbor friend had
> > > gotten his hands on,, shortly before The Beatles became NYC bound.
> > > That memory still makes me feel elation upon the remembrance of
> > > repeatedly playing it,
>
> > First memory, hazy now it was so long ago, hearing Twist And Shout on
> > the radio. I'd have been eight, going on nine. I was the most exciting
> > sound I'd ever heard and from then on I couldn't wait to hear more and
> > more Beatles records. From Me To You and She Loves You followed soon
> > after to justify my excitement - but we had to rely on the radio as it
> > was several years before we had our own record player.
>
> That's what makes it a problem for 2nd-3rd generation Beatles fans:We
> had the luxury to wait and see chronologically, what was to come next,
> album by album, while later fans often get song/album release timings
> mixed up.

Yes, I've heard that said before. ;-)

Marc

http://marccatone.webs.com/beatless...

Donna

10/16/2011 11:24:00 PM

0

On Oct 16, 4:42 pm, marcus <marcus...@yahoo.com> wrote:
> On Oct 16, 3:20 pm, Tim <tdwilliams...@sbcglobal.net> wrote:
>
> > That's what makes it a problem for 2nd-3rd generation Beatles fans:We
> > had the luxury to wait and see chronologically, what was to come next,
> > album by album, while later fans often get song/album release timings
> > mixed up.
>
> Yes, I've heard that said before. ;-)

Me, too! Call me crazy, but I somehow get the feeling that there
might be somebody floating around who is not too fond of that belief.

Tim

10/17/2011 4:55:00 AM

0

On Oct 16, 4:23 pm, Donna <tom.r...@ix.netcom.com> wrote:
> On Oct 16, 4:42 pm, marcus <marcus...@yahoo.com> wrote:
>
> > On Oct 16, 3:20 pm, Tim <tdwilliams...@sbcglobal.net> wrote:
>
> > > That's what makes it a problem for 2nd-3rd generation Beatles fans:We
> > > had the luxury to wait and see chronologically, what was to come next,
> > > album by album, while later fans often get song/album release timings
> > > mixed up.
>
> > Yes, I've heard that said before. ;-)
>
> Me, too!  Call me crazy, but I somehow get the feeling that there
> might be somebody floating around who is not too fond of that belief.

Watching their career unfold in real time was something to behold in
terms of the constant buzz by reporters following their every move
every day, writing front page newspaper news articles. Same behaviour
went on with radio disk jockies..

It seems to me we don't see that anymore with anywhere near that
intensity with today's performers,with anything I can recall, short of
the OJ Simpson Trial.

And as I recall it was George who later remarked that from his pov, it
was the world that went insane for the duration of their career and
then (we) tried to blame it on The Beatles, while they themselves were
just living their lives as normally as we'd allow them to, with our
obsessive adulation encircling their every move.

Whereas later followers, to their dismay, would had have to have been
there in real time to truly get it...or so it would seem with the
benefit of hindsight.

JohnB

10/17/2011 9:54:00 AM

0

On Oct 17, 12:23 am, Donna <tom.r...@ix.netcom.com> wrote:
> On Oct 16, 4:42 pm, marcus <marcus...@yahoo.com> wrote:
>
> > On Oct 16, 3:20 pm, Tim <tdwilliams...@sbcglobal.net> wrote:
>
> > > That's what makes it a problem for 2nd-3rd generation Beatles fans:We
> > > had the luxury to wait and see chronologically, what was to come next,
> > > album by album, while later fans often get song/album release timings
> > > mixed up.
>
> > Yes, I've heard that said before. ;-)
>
> Me, too!  Call me crazy, but I somehow get the feeling that there
> might be somebody floating around who is not too fond of that belief.

Regardless of how anyone may wish to argue the point, the fact is that
the experience was different in real time than it was retrospectively,
and no one who experienced it one way can ever properly understand the
opposite experience. Personally I'm glad I was alive at the time and
picked up on the Beatles from early '63. If others want to try to
diminish that, well, that's their business. It doesn't change what I
felt.

Stephen X. Carter

10/17/2011 1:43:00 PM

0

On Sat, 15 Oct 2011 21:11:22 -0700 (PDT), Donna <tom.rach@ix.netcom.com>
wrote:

>On Oct 15, 11:58?pm, Stephen X. Carter <steve@[127.0.0.1]> wrote:
>
>> And. ?Liek just about everyone else in the UK I listened in to the Kenny
>> Everett show when he played Sgt. Pepper for the first time. Warm summer
>> day, everywhere people had their radio on, windows open, listening.
>> Magical.
>>
>> (The BBC still have a copy of that entire broadcast, which they play
>> from time to time).
>
>Being from the US, I didn't know about this broadcast, Stephen, but I
>think I found it on youtube, and I'm listening to it now. Here's the
>first part:
>
>http://www.youtube.com/watch?v=5...


That's it....

--
steve.hat.stephencarter.not.com.but.net
Nothing is Beatle Proof!!
Mr Kite posters and more at http://www.zazzle.c...*
Mr Kite posters and more at http://www.zazzle.co....*

marcus

10/18/2011 12:53:00 AM

0

On Oct 17, 5:53 am, JohnB <johnbo...@tinyworld.co.uk> wrote:
> On Oct 17, 12:23 am, Donna <tom.r...@ix.netcom.com> wrote:
>
> > On Oct 16, 4:42 pm, marcus <marcus...@yahoo.com> wrote:
>
> > > On Oct 16, 3:20 pm, Tim <tdwilliams...@sbcglobal.net> wrote:
>
> > > > That's what makes it a problem for 2nd-3rd generation Beatles fans:We
> > > > had the luxury to wait and see chronologically, what was to come next,
> > > > album by album, while later fans often get song/album release timings
> > > > mixed up.
>
> > > Yes, I've heard that said before. ;-)
>
> > Me, too!  Call me crazy, but I somehow get the feeling that there
> > might be somebody floating around who is not too fond of that belief.
>
> Regardless of how anyone may wish to argue the point, the fact is that
> the experience was different in real time than it was retrospectively,
> and no one who experienced it one way can ever properly understand the
> opposite experience. Personally I'm glad I was alive at the time and
> picked up on the Beatles from early '63. If others want to try to
> diminish that, well, that's their business. It doesn't change what I
> felt.

And yet...some folks do try to diminish that.

Go figure.

Marc

http://marccatone.webs.com/apps/photos/photo?photoid...