Module: Polyfill::V2_4::String::Instance::Prepend::Method

Defined in:
lib/polyfill/v2_4/string/instance/prepend.rb

Instance Method Summary collapse

Instance Method Details

#prepend(*others) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/polyfill/v2_4/string/instance/prepend.rb', line 7

def prepend(*others)
  return super if others.length == 1

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

  replace(acc)
end