lib/invoca/utils/array.rb in invoca-utils-0.2.0 vs lib/invoca/utils/array.rb in invoca-utils-0.3.0

- old
+ new

@@ -1,20 +1,18 @@ # 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 +# TODO: Once the hobo_support gem is no longer used by any of our code, use prepend instead of alias +class Array + + alias_method :original_multiply_operator, :* # rubocop:disable Style/Alias + + def *(rhs = nil) + if rhs + original_multiply_operator(rhs) + else + Invoca::Utils::MultiSender.new(self, :map) end end end - -Array.prepend(Invoca::Utils::ArrayMultiply)