rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* rack-1.2.1 breaks with ruby 1.8.6
@ 2010-07-14 14:01 candlerb
  2010-07-14 14:05 ` candlerb
  0 siblings, 1 reply; 5+ messages in thread
From: candlerb @ 2010-07-14 14:01 UTC (permalink / raw)
  To: Rack Development

I started getting this error after upgrading from rack-1.1.0 to
rack-1.2.1:

/usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138:in
`union': can't convert Array into String (TypeError)
	from /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138

It turns out to be easily fixed. ruby-1.8.7 allows two different
formats of Regexp.union:

    >> Regexp.union("a","b","c")
    => /a|b|c/
    >> Regexp.union(["a","b","c"])
    => /a|b|c/

but ruby-1.8.6 only allows one of these:

    >> Regexp.union("a","b","c")
    => /a|b|c/
    >> Regexp.union(["a","b","c"])
    TypeError: can't convert Array into String
	from (irb):4:in `union'
	from (irb):4
	from :0

So the solution is to add an "*" here in rack/utils.rb line 138:

        ESCAPE_HTML_PATTERN = Regexp.union(*ESCAPE_HTML.keys)

Incidentally, I also get the following warning with -w:

/usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/server.rb:228:
warning: parenthesize argument(s) for future version

The solution is to change that line from
    options.merge! opt_parser.parse! args
to
    options.merge! opt_parser.parse!(args)

Regards, Brian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-14 17:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-14 14:01 rack-1.2.1 breaks with ruby 1.8.6 candlerb
2010-07-14 14:05 ` candlerb
2010-07-14 15:56   ` James Tucker
2010-07-14 16:39     ` Christian Neukirchen
2010-07-14 17:00       ` James Tucker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).