Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/http/cookie/ruby_compat.rb

Instance Method Summary collapse

Instance Method Details

#select!Object


2
3
4
5
6
7
8
9
10
11
12
# File 'lib/http/cookie/ruby_compat.rb', line 2

def select! # :yield: x
  i = 0
  each_with_index { |x, j|
    yield x or next
    self[i] = x if i != j
    i += 1
  }
  return nil if i == size
  self[i..-1] = []
  self
end

#sort_by!(&block) ⇒ Object


14
15
16
# File 'lib/http/cookie/ruby_compat.rb', line 14

def sort_by!(&block) # :yield: x
  replace(sort_by(&block))
end