From: Love U Ruby Date: 2013-03-17T23:10:09+09:00 Subject: Re: Confusion with `nil` output from the method Symbol#<=> Hans Mackowiak wrote in post #1101981: > both the functions return nil because > > :x <=> "x" , "x" is not a symbol, so return nil I understand the above. > "x" <=> :x , :x does not respond to to_str, so return nil But the above one is confusing. What it returns from the C code: return rb_str_cmp_m( ? , rb_sym_to_s(other). As string would fail on rb_sym_to_s("x") >> "x".interim NoMethodError: undefined method `interim' for "x":String from (irb):8 from C:/Ruby200/bin/irb:12:in `
' > if you "couldn't understand" C code, stop reading it and look at more > easier tutorials -- Posted via http://www.ruby-forum.com/.