Sha256: 95eb690c71484617af4e560a2a0a98abba23313348dbe529f973752a2ddcc2a0

Contents?: true

Size: 641 Bytes

Versions: 1

Compression:

Stored size: 641 Bytes

Contents

module Polyfill
  module V2_4
    module String
      module Instance
        module Prepend
          module Method
            def prepend(*others)
              return super if others.length == 1

              acc = '' << self
              others.reverse_each do |other|
                acc.prepend(other)
              end

              replace(acc)
            end
          end

          if RUBY_VERSION < '2.4.0'
            refine ::String 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/string/instance/prepend.rb