# frozen_string_literal: true

require_relative './multi_sender'

# Invoca ::Array extensions
module Invoca
  module Utils
    module ArrayMultiply
      def *(rhs = nil)
        if rhs
          super
        else
          Invoca::Utils::MultiSender.new(self, :map)
        end
      end
    end
  end
end

Array.prepend(Invoca::Utils::ArrayMultiply)

# frozen_string_literal: true

require_relative './multi_sender'

# Invoca ::Array extensions
# TODO: Once the hobo_support gem is no longer used by any of our code, use prepend instead of alias
class Array

  alias_method :multiply, :*

  def *(rhs=nil)
    if rhs
      multiply(rhs)
    else
      Invoca::Utils::MultiSender.new(self, :map)
    end
  end
end

Use alias_method instead of prepend to avoid conflicts with hobo_support
TECH-4409: Use alias_method instead of prepend to avoid conflicts with hobo_support

Uses prepend causes infinite recursion when the hobo_support gem is also present. This gem will be present for a while until we remove it everywhere. Use the hobo version of the code here to preserve compatability
