From: Dark Ambient Date: 2006-08-11T21:47:52+09:00 Subject: Question on setting up a class and searching on objects I'm working from Ruby for Rails book but want to try and just replicate some of the examples in Ruby alone. One method in particular is called whole_name and would give the user the ability to search a list by first_name, middle_name, or last_name. So I went ahead and set up my class and objects, but have a few questions (below code) class Composer def listcomp (first_name, middle_name, last_name) f = first_name m = middle_name l = last_name end def whole_name first_name + " " + (if middle_name then middle_name + " " else "" end) + last_name end end comp1 = Composer.new comp2 = Composer.new comp3 = Composer.new comp4 = Composer.new comp5 = Composer.new comp1.listcomp("ludwig","van","bethoven") comp2.listcomp("wolfgang","amadeus","mozart") comp3.listcomp("franz", "joseph", "hayden") comp4.listcomp("George", "frederic", "Handel") comp5.listcomp("Johann", "sebastian", "bach") Question - I'm having a problem calling to the class method whole_name. The method is defined without any arguments so how could it be called ? Question - Did I set up the class correctly , defining the new object outside of the class definition ? And would it be better to create an array (multidimensional) for the composers instead of initializing each one seperately ? (If this question makes sense) Apologies if this question is sort of lame. TIA Stuart