On 10/13/2011 09:15 AM, Tong Li wrote:
\ No newline at end of file
> > + - @collections.each do|api|
> > + - res_name = api[0].to_s.gsub(/_[a-z]/) {|match| match
> [1].to_s.upcase }
>
> There's a little Ruby surprise for you: match[1] is actually an integer;
> and "ab"[1].to_s.upcase == "98"
used irb and run "ab"[1].to_s.upcase, I got "B" as I expected. This is
using Ruby
C:\Users\IBM_ADMIN>irb
irb(main):001:0> "ab"[1].to_s.upcase
=> "B"
This is a ruby 1.8/1.9 issue.
Looks like David is using Ruby 1.8 and you're using 1.9. The []
operation on string changed between the two:
http://www.ruby-doc.org/core-1.8.6/String.html#method-i-5B-5D
vs.
http://www.ruby-doc.org/core-1.9.2/String.html#method-i-5B-5D
Scott