Sha256: e5d60cbc0eafa560e852510b463e82085bbb5ae1f314608f5ed52a86f936535d

Contents?: true

Size: 579 Bytes

Versions: 3

Compression:

Stored size: 579 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

          refine ::String do
            include Method
          end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
polyfill-0.6.0 lib/polyfill/v2_4/string/instance/prepend.rb
polyfill-0.5.0 lib/polyfill/v2_4/string/instance/prepend.rb
polyfill-0.4.0 lib/polyfill/v2_4/string/instance/prepend.rb