Sha256: 7a542f322076842afb5c187d1f7498886a0af0e1ea1be65a3c889327999673bc

Contents?: true

Size: 431 Bytes

Versions: 5

Compression:

Stored size: 431 Bytes

Contents

class Hash
  
  ##
  # Delete key-value pairs, returning the values found
  # using the +keys+ passed. Aliased as extract!
  #
  # === Examples
  #
  #   options = { :width => 25, :height => 100 }
  #   width, height = options.delete_at :width, :height  
  #
  #   width   # => 25
  #   height  # => 100
  #   options # => {}
  #
  
  def delete_at *keys
    keys.map { |key| delete key }
  end
  alias :extract! :delete_at
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
visionmedia-rext-0.0.2 lib/rext/hash/helpers.rb
visionmedia-rext-0.0.3 lib/rext/hash/helpers.rb
visionmedia-rext-0.0.4 lib/rext/hash/helpers.rb
visionmedia-rext-0.0.5 lib/rext/hash/helpers.rb
visionmedia-rext-0.0.6 lib/rext/hash/helpers.rb