- # destructures the parameter values according to the order of the sorted keys
- # Usage:
- # hash = { :macbook => 1, :iphone => 2, :ipad => 3 }
- # ipad, iphone, macbook = destructuring_bind(hash)
- def destructuring_bind(hash)
- hash.sort_by {|k, v| k.to_s }.map {|e| e[1] }.flatten
- end