Convert an array to a hash
May 04
2008
2008
Comments Off
class Array def to_h arr = self.dup if arr.size % 2 == 0 Hash[*arr] else Hash[*arr < < nil] end end end
my web space
class Array def to_h arr = self.dup if arr.size % 2 == 0 Hash[*arr] else Hash[*arr < < nil] end end end