method

invert

Importance_1
v2_2_9 - Show latest stable - 0 notes - Class: SDBM
invert() public

Returns a Hash in which the key-value pairs have been inverted.

Example:

require 'sdbm'

SDBM.open 'my_database' do |db|
  db.update('apple' => 'fruit', 'spinach' => 'vegetable')

  db.invert  #=> {"fruit" => "apple", "vegetable" => "spinach"}
end
Show source
Register or log in to add new notes.