Here's one way, off the top of my head:
range = Date.parse("February 1, 2013")..Date.parse("January 15, 2014")
range.to_a.map {|date| Date.new(date.year,date.month,1)}.uniq.map {|date| date.next_month.prev_day}
Or in other words:
For every date in the array
- Make the day element equal to 1 to find the first of each month ...
- Make the set unique, so you have one element per month ...
- Add one month to each value ...
- Subtract one day.