Sha256: da51f1e4a63502248771c8e3967c4717705934baf8cd814f62317eff7fb19142

Contents?: true

Size: 456 Bytes

Versions: 21

Compression:

Stored size: 456 Bytes

Contents

# Temp until https://github.com/opal/opal/pull/596
require 'set'

class Set
  def delete(o)
    if include?(o)
      @hash.delete(o)
      true
    else
      nil
    end
  end

  def delete_if
    block_given? or return enum_for(__method__)
    # @hash.delete_if should be faster, but using it breaks the order
    # of enumeration in subclasses.
    select { |o| yield o }.each { |o| @hash.delete(o) }
    self
  end

  def to_a
    @hash.keys
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
volt-0.9.3.pre4 lib/volt/utils/set_patch.rb