Dirk Meijer ha scritto:
> hi everyone,
> i've created a class, and want it to be comparable with itself, but i don't
> know what to place inside the <=> method.
> the basic idea is that one of the values of the class (which is a symbol) is
> converted to a string, which is then compared.
> greetings, Dirk.
> 

yuu should return 1 if self > b, 0 if self == b and -1 otherwise.
You can generally realy on some other <=>, i.e.

 >> Foo= Struct.new :someval do
?>  def <=> other
 >>   someval.to_s <=> other.someval.to_s
 >>  end
 >>  include Comparable
 >> end
=> Foo
 >> f1=Foo.new "ciao"
=> #<struct Foo someval="ciao">
 >> f2=Foo.new "miao"
=> #<struct Foo someval="miao">
 >> f1 < f2
=> true
 >> f1 >= f2
=> false

hope this helps