Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
This paste will be private.
class Array def to_h h = {} each do |x| arr = yield x h[arr.first] = arr.last end h end end str="foo=bar\nbaz=quux\napple=orange\n" p str.split(/\n/).to_h { |pair| pair.split(/=/) }
From the Design Piracy series on my blog: