I noticed that the method DSTK::DSTK.u does not appear to produce the correct output on Ruby 1.9.3-p392 sometimes produces unexpected results, for example:
irb(main):005:0> dstk.u "1600 Amphitheatre Parkway Mountain View CA"
ArgumentError: invalid value for Integer(): " "
from /home/user/.rvm/gems/ruby-1.9.3-p392/gems/dstk-0.50.2/lib/dstk.rb:38:in `sprintf'
from /home/user/.rvm/gems/ruby-1.9.3-p392/gems/dstk-0.50.2/lib/dstk.rb:38:in `block in u'
from /home/user/.rvm/gems/ruby-1.9.3-p392/gems/dstk-0.50.2/lib/dstk.rb:38:in `gsub'
from /home/user/.rvm/gems/ruby-1.9.3-p392/gems/dstk-0.50.2/lib/dstk.rb:38:in `u'
from (irb):5
from /home/user/.rvm/rubies/ruby-1.9.3-p392/bin/irb:13:in `<main>'
As I haven't been able to track down the location where the code of the gem is hosted, so I'll just report it here. In my case I've simply resolved it by using encoding provided by open-uri:
require 'open-uri'
def u(value)
URI::encode(value)
end
Of course this can be solved even neater by simply removing the u-method and using this encoding method directly. I've tried to look up the url that is mentioned in the comments (http://web.elctech.com/?p=58) but it appears to be down, so I'm not sure there's some edge case at play here or if the method is actually faulty.
Hey,
I noticed that the method DSTK::DSTK.u does not appear to produce the correct output on Ruby 1.9.3-p392 sometimes produces unexpected results, for example:
As I haven't been able to track down the location where the code of the gem is hosted, so I'll just report it here. In my case I've simply resolved it by using encoding provided by
open-uri
:Of course this can be solved even neater by simply removing the
u
-method and using this encoding method directly. I've tried to look up the url that is mentioned in the comments (http://web.elctech.com/?p=58) but it appears to be down, so I'm not sure there's some edge case at play here or if the method is actually faulty.