I am getting TypeError: can’t convert String into Integer, I found
duplicate answer too, but I am facing this error for ‘pack’.
Other confusion is, it is working fine with ruby 1.8.7, not with ruby
1.9.3, here is the code
irb(main):003:0> length=nil
=> nil
irb(main):004:0> token_string ||= [“A”…“Z”,“a”…“z”,“0”…“9”].collect {
|r| r.to_a }.join + %q(!$:)
=> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!$:"
irb(main):005:0> token = (0…(length ? length : 60)).collect {
token_string[rand( token_string.size)]}.pack(“c*”)
TypeError: can’t convert String into Integer
from (irb):5:in pack' from (irb):5 from /home/appandya/.rvm/rubies/ruby-1.9.3-p374/bin/irb:13:in
’
irb(main):006:0>
Ant Ideas?