<NME> regexp_union_takes_array.rb
<BEF> ADDFILE
<MSG> - Backport Ruby 1.8.7 Regexp.union([array]) so Rack 1.2.1 works in Ruby
  <= 1.8.6. This should fix issue
  http://code.google.com/p/logstash/issues/detail?id=5

  Tested in rvm with:
  'rvm 1.8.6 exec bin/logstash-web'

<DFF> @@ -0,0 +1,27 @@
+# Check if Regexp.union takes an array. If not, monkeypatch it.
+# This feature was added in Ruby 1.8.7 and is required by 
+# Rack 1.2.1, breaking ruby <= 1.8.6
+
+needs_fix = false
+begin
+  Regexp.union(["a", "b"])
+rescue TypeError => e
+  if e.message == "can't convert Array into String"
+    needs_fix = true
+  end
+end
+
+if needs_fix
+  class Regexp
+    class << self
+      alias_method :orig_regexp_union, :union
+      public
+      def union(*args)
+        if args[0].is_a?(Array) && args.size == 1
+          return orig_regexp_union(*args[0])
+        end
+        return orig_regexp_union(*args)
+      end # def union
+    end # class << self 
+  end # class Regexp
+end # if needs_fix

- Backport Ruby 1.8.7 Regexp.union([array]) so Rack 1.2.1 works in Ruby   <= 1.8.6. This should fix issue   http://code.google.com/p/logstash/issues/detail?id=5