Sha256: f08bdc3763f44713553e0a361c636f1ad5657923b54e931613d095c68b047acf

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

module Polyfill
  module V2_4
    module Array
      module Instance
        module Concat
          module Method
            def concat(*others)
              return super if others.length == 1

              acc = [].concat(self)
              others.each do |other|
                acc.concat(other)
              end

              replace(acc)
            end
          end

          if RUBY_VERSION < '2.4.0'
            refine ::Array do
              include Method
            end

            def self.included(base)
              base.include Method
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyfill-0.3.0 lib/polyfill/v2_4/array/instance/concat.rb