Sha256: 823911329d502a15ad4ef6c6b711a6af44cbd214a725f7b9fa3af220cd16b60f
Contents?: true
Size: 502 Bytes
Versions: 8
Compression:
Stored size: 502 Bytes
Contents
# # auto vivifying ordered hash that dumps as yaml nicely # require 'orderedhash' unless defined? OrderedHash class AutoOrderedHash < OrderedHash def initialize(*args) super(*args){|a,k| a[k] = __class__.new(*args)} end def class # for nice yaml Hash end def __class__ AutoOrderedHash end end # class AutoOrderedHash OrderedAutoHash = AutoOrderedHash def OrderedAutoHash(*a, &b) OrderedAutoHash.new(*a, &b) end def AutoOrderedHash(*a, &b) AutoOrderedHash.new(*a, &b) end
Version data entries
8 entries across 8 versions & 4 rubygems