def moving_average(average_specifier)
      if average_specifier.kind_of?(Array)
        avg = MovingAverage.weighted(average_specifier)
      elsif average_specifier.kind_of?(Integer)
        avg = MovingAverage.simple(average_specifier)
      else
        raise ArgumentError.new("Unknown weights")
      end
      
      avg.calculate(self)
    end
def moving_average(average_specifier)
      if average_specifier.kind_of?(Array)
        avg = MovingAverage.weighted(average_specifier)
      elsif average_specifier.kind_of?(Integer)
        avg = MovingAverage.simple(average_specifier)
      else
        raise ArgumentError.new("Unknown weights")
      end
      
      avg.calculate(self)
    end
Returns a moving average for this array, given either a number
 of terms or a list of weights.

 See MovingAverage for more detail.