Sha256: f1ace69566fa13e9158fd43f43ae9a72d2dacb0d3c967006420893eb837550d2

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

module Polyfill
  module V2_4
    module String
      module Class
        module New
          module Method
            def new(*args)
              hash = args.find { |arg| arg.is_a?(::Hash) }
              hash && hash.delete(:capacity) if hash

              super(*args)
            end
          end

          refine ::String.singleton_class 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/class/new.rb
polyfill-0.5.0 lib/polyfill/v2_4/string/class/new.rb
polyfill-0.4.0 lib/polyfill/v2_4/string/class/new.rb