How to build a case-insensitive regular expression with Regexp.union
<p>I have a list of strings, and need to build the regular expression from them, using <a href="http://ruby-doc.org/core-2.3.1/Regexp.html#method-c-union" rel="nofollow"><code>Regexp#union</code></a>. I need the resulting pattern to be <em>case insensitive</em>.</p>

<p>The <code>#union</code> method itself does not accept options/modifiers, hence I currently see two options:</p>

<pre><code>strings = %w|one two three|

Regexp.new(Regexp.union(strings).to_s, true)
</code></pre>

<p>and/or:</p>

<pre><code>Regexp.union(*strings.map { |s| /#{s}/i })
</code></pre>

<p>Both variants look a bit weird.</p>

<p>Is there an ability to construct a case-insensitive regular expression by using <code>Regexp.union</code>?</p>