sdbm.select { |key, value| ... } รข Array
Instance Public methods
Returns a new Array of key-value pairs for which the block returns
true
.
Example:
require 'sdbm' SDBM.open 'my_database' do |db| db['apple'] = 'fruit' db['pear'] = 'fruit' db['spinach'] = 'vegetable' veggies = db.select do |key, value| value == 'vegetable' end #=> [["apple", "fruit"], ["pear", "fruit"]] end
Please login to continue.