Ruby method to get the months of quarters a given date belongs to

You can get the quarter from any date by doing this:

quarter = (((Date.today.month - 1) / 3) + 1).to_i

Or even shorter:

quarter = (Date.today.month / 3.0).ceil

You can define a function for that to accept the date as argument and return the quarter

def current_quarter_months(date)
  quarters = [[1,2,3], [4,5,6], [7,8,9], [10,11,12]]
  quarters[(date.month - 1) / 3]
end

The function will return array based on the the value of the quarter the date belongs to.