lib/vscal/calendar_printer.rb
def print_months_side_by_side(month_slice)
      # get the grid for each month into an array of array strings
      month_grids = month_slice.map { |month| month_display_grid(month) }

      # calculate the max number of printable lines and add empty line padding
      # as needed so every grid has the same number of lines to print
      max_line_count = month_grids.map(&:size).max
      month_grids = month_grids.map { |month| month + [EMPTY_WEEK_ROW] * (max_line_count - month.size) }

      # combine the different month grids so they can be printed side by side
      merged_month_grids = month_grids.transpose.map { |row| row.join(MONTH_GUTTER) }.join("\n")

      puts merged_month_grids
      puts
    end
# print the grids for the given months side by side in order
print the grids for the given months side by side in order
print the grids for the given months side by side in order
def print_months_side_by_side(month_slice)
      month_grids = month_slice.map { |month| month_display_grid(month) }
      max_line_count = month_grids.map(&:size).max
      month_grids = month_grids.map { |month| month + [EMPTY_WEEK_ROW] * (max_line_count - month.size) }
      merged_month_grids = month_grids.transpose.map { |row| row.join(MONTH_GUTTER) }.join("\n")
      puts merged_month_grids
      puts
    end
def print_months_side_by_side ( month_slice ) month_grids = month_slice . map { | month | month_display_grid ( month ) } max_line_count = month_grids . map ( & :size ) . max month_grids = month_grids . map { | month | month + [ EMPTY_WEEK_ROW ] * ( max_line_count - month . size ) } merged_month_grids = month_grids . transpose . map { | row | row . join ( MONTH_GUTTER ) } . join ( "\n" ) puts merged_month_grids puts end
print the grids for the given months side by side in order
print the grids for the given months side by side in order
# get the grid for each month into an array of array strings # calculate the max number of printable lines and add empty line padding # as needed so every grid has the same number of lines to print # combine the different month grids so they can be printed side by side
month_slice