Hammed Malik
2006-Sep-27 21:42 UTC
Strange error in jcode.rb when converting range to array
In my rails app I''ve line with the following code:
("a".."z").to_a
Simple enough and it''s been working for a while. Last night this line
started throwing the following error:
undefined method `[]'' for nil:NilClass
/usr/local/lib/ruby/1.8/jcode.rb:83:in `succ!''
/usr/local/lib/ruby/1.8/jcode.rb:94
I looked up jcode.rb and the comments for this file say that it''s
"#
jcode.rb - ruby code to handle japanese (EUC/SJIS) string"
This is the part of jcode.rb that throws the error (line 83)
78 def succ!
79 reg = end_regexp
80 if self =~ reg
81 succ_table = SUCC[$KCODE[0,1].downcase]
83 begin
84 self[-1] += succ_table[self[-1]]
85 self[-2] += 1 if self[-1] == 0
86 end while self !~ reg
87 self
88 else
89 original_succ!
90 end
91 end
Debugging is difficult because if I restart the app, the problem goes
away..for a while. Has anyone else encountered this error before?
It''s obviously being caused by something I''ve added to my app
recently. I just can''t figure out what.
ruby -v
ruby 1.8.4 (2005-12-24) [i686-darwin8.5.2]
Thanks
Hammed
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---