title: How can I override the .. and ... operators of Ruby Ranges to accept Float::INFINITY?
body: <p>I want to override the <code>..</code> and <code>...</code> operators in Ruby's <code>Range</code>.</p>
  
  <p>Reason is, I'm working with infinite date ranges in the database. If you pull an <code>infinty</code> datetime out of Postgres, you get a <code>Float::INFINITY</code> in Ruby.</p>
  
  <p>The problem with this is, I cannot use <code>Float::INFINITY</code> as the end of a range:</p>
  
  <pre><code>Date.today...Float::INFINITY
  =&gt; Wed, 02 Nov 2016...Infinity 
  
  DateTime.now...Float::INFINITY
  # ArgumentError: bad value for range
  
  Time.now...Float::INFINITY
  # ArgumentError: bad value for range
  </code></pre>
  
  <p>... yet I use <code>..</code> and <code>...</code> syntax quite often in my code.</p>
  
  <p>To even be able to construct the range, you need to use  <code>DateTime::Infinity.new</code> instead:</p>
  
  <pre><code>Date.today...DateTime::Infinity.new
  =&gt; Wed, 02 Nov 2016...#&lt;Date::Infinity:0x007fd82348c698 @d=1&gt; 
  
  DateTime.now...DateTime::Infinity.new
  =&gt; Wed, 02 Nov 2016 12:57:07 +0000...#&lt;Date::Infinity:0x007fd82348c698 @d=1&gt; 
  
  Time.now...DateTime::Infinity.new
  =&gt; 2016-11-02 12:57:33 +0000...#&lt;Date::Infinity:0x007fd82348c698 @d=1&gt; 
  </code></pre>
  
  <p>But I would need to do the the <code>Float::INFINITY</code> -> <code>DateTime::Infinity.new</code> conversion every time:</p>
  
  <p><code>model.start_time...convert_infinity(model.end_time)</code></p>
  
  <p>Is there a way I can override the <code>..</code> and <code>...</code> operators so that I can incorporate the conversion function and keep the syntactic sugar?</p>