addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupsimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1outlookpersonJoin Group on CardStartprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

a few simple ruby (non-rails) questions

From: Travis H.
Sent on: Wednesday, July 28, 2010 2:24 PM
1) Need multiple ways to construct objects, with arguments (or
   signature) of the same type.

   What's canonical way?  Create a class method similar to new()
   that calls a different method than initialize?

   Right now I do something like:

   a =­_from_string(str)
   b =­_from_filename(fn)

   In this case, initialize is simply empty or non-existent.
   Seems like a waste of keystrokes to have new() in there.

2) Need to do array -= [ x ], and subtract anything in array
   that is eql? to x (not x itself, but merely having same data).
   Got any ideas how to implement this easily?

3) Is it really true that there's no way to call an instance method in
   a parent class except from the same-named method in the subclass?
   super doesn't return a real object, so I'm just curious if there's
   a workaround other than renaming methods.

4) Does Class#method mean an instance method, or a class method?
   I get confused and never ever saw this explained anywhere.

For anyone who is interested in the project, it's here:


I'm also slowly going back through my SVN logs and writing up a
"evolution of the design of HDB" document.  As a programmer of some 30
years, I have never come across a document describing the actual
process of programming. I recall hearing once that looking at a
finished mathematical proof leads you to believe the mathematician was
a genius, and also gives no clue as to how to actually create a
proof. It is therefore most instructive to look at how they actually
develop their proofs so that one gets a feel for the process (and
realize that it is not as intimidating as it seems, but does require a
lot of hard work, just like programming).  Here's what I have so far:


It should be interesting to people learning OOD/OOP and/or ruby.
A Weapon of Mass Construction
My emails do not have attachments; it's a digital signature that your mail
program doesn't understand. | http://www.subspa...­ 
If you are a spammer, please email [address removed] to get blacklisted.

This email message originally included an attachment.

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy