Class: Set

Inherits:
Object show all
Defined in:
lib/backports/1.9.2/stdlib/set.rb

Instance Method Summary collapse

Instance Method Details

#delete_ifObject



2
3
4
5
6
# File 'lib/backports/1.9.2/stdlib/set.rb', line 2

def delete_if
  block_given? or return enum_for(__method__)
  to_a.each { |o| @hash.delete(o) if yield(o) }
  self
end

#keep_ifObject



8
9
10
11
12
# File 'lib/backports/1.9.2/stdlib/set.rb', line 8

def keep_if
  block_given? or return enum_for(__method__)
  to_a.each { |o| @hash.delete(o) unless yield(o) }
  self
end