You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: greyscale.rb
    path of file: ./repos/psd.rb/lib/psd/image_modes
    
    the code of the file until where you have to start completion: class PSD
  module ImageMode
    mod
    
      def combine_greyscale_channel
        if channels == 2
          (0...@num_pixels).step(pixel_step) do |i|
            grey = @channel_data[i]
            alpha = @channel_data[@channel_length + i]

            @pixel_data.push ChunkyPNG::Color.grayscale_alpha(grey, alpha)
          end
        else
          (0...@num_pixels).step(pixel_step) do |i|
            @pixel_data.push ChunkyPNG::Color.grayscale(@channel_data[i])
          end
        end