david thanks for your help
I have another question here perhaps you can help me out here
normally when you do a sort it's working like this

cursus =["java", "cobalt","php","ruby"]
x=cursus.sort
puts x

this is working like a charm but when I try to implement this in the 
code mentioned earlier I get a error message like this
oefeningen/_cursus_applic.rb:20:in `sort': undefined method `<=>' for 
#<Cursus:0x28b55f4> (NoMethodError)
  from oefeningen/_cursus_applic.rb:20

how can I solve this one?
thanks for your help

Paul
David A. Black wrote:
> Hi --
> 
> On Sat, 1 Dec 2007, Paul Private wrote:
> 
>> require "collecties/cursus"
>> class Cursus_applic
>>  cursussen = [Cursus.new('Ruby - 1','Jan', 18.15, 10),
>>  Cursus.new('Ruby - 2','Piet', 18.15, 8),
>>  Cursus.new('Java - 1','Els', 14, 15),
>>  Cursus.new('Java - 2','Jan', 14, 10),
>>  Cursus.new('Java - 3','Piet', 18.15, 8)
>>  ]
>>
>>  puts '5. First all Java courses then followed by the others: '
>>  cursus_java = cursussen.partition {|cursus|cursus_java?(true)}
> 
> You're using a non-existent method, "cursus_java?" You probably want
> to do:
> 
>    java, non_java = cursussen.partition {|cursus| cursus.naam?("Java") }
> 
> or something along those lines.
> 
>>  puts '6. Alle cursussen gesorteerd op cursus naam: '
>>  puts '7. Alle cursussen voorafgegaan met de index: '
>>
>> end
>> and the cursus.rb is mentioned here below
>> class Cursus
>>  attr :naam, false
>>  attr_reader :docent
>>  attr :tijdstip, false
>>  attr_reader :aantal_cursisten
> 
> I believe that attr + false is the same as attr_reader -- except more
> cryptic :-) It's best to stick to:
> 
>    attr_reader
>    attr_writer
>    attr_accessor
> 
> since the true/false parameter is not self-explanatory.
> 
> 
> David

-- 
Posted via http://www.ruby-forum.com/.