title: How do I return an array of days and hours from a range?
body: <p>How do I return an array of days and hours from a range? So far I have tried:</p>
  
  <pre><code>(48.hours.ago..Time.now.utc).map { |time| { :hour =&gt; time.hour } }.uniq
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>[{:hour=&gt;1}, {:hour=&gt;2}, {:hour=&gt;3}, {:hour=&gt;4}, {:hour=&gt;5}, {:hour=&gt;6}, {:hour=&gt;7}, {:hour=&gt;8}, {:hour=&gt;9}, {:hour=&gt;10}, {:hour=&gt;11}, {:hour=&gt;12}, {:hour=&gt;13}, {:hour=&gt;14}, {:hour=&gt;15}, {:hour=&gt;16}, {:hour=&gt;17}, {:hour=&gt;18}, {:hour=&gt;19}, {:hour=&gt;20}, {:hour=&gt;21}, {:hour=&gt;22}, {:hour=&gt;23}, {:hour=&gt;0}] 
  </code></pre>
  
  <p>Not ideal, since its iterates over every second. Which takes a long time. And I get several warning messages that say:</p>
  
  <pre><code>/Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.2/lib/active_support/time_with_zone.rb:328: warning: Time#succ is obsolete; use time + 1
  </code></pre>
  
  <p>I am trying to return something like:</p>
  
  <pre><code>[{:day =&gt; 25, :hour=&gt;1}, {:day =&gt; 25, :hour=&gt;2}, {:day =&gt; 25, :hour=&gt;3}, {:day =&gt; 25, :hour=&gt;4} ... {:day =&gt; 26, :hour=&gt;1}, {:day =&gt; 26, :hour=&gt;2}, {:day =&gt; 26, :hour=&gt;3}, {:day =&gt; 26, :hour=&gt;4}] 
  </code></pre>