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

Version Path
ThiagoLelis-backgroundjob-1.0.4 lib/orderedautohash.rb
vibes-bj-1.2.2 spec/rails_root/vendor/plugins/bj/lib/orderedautohash.rb
vibes-bj-1.2.1 spec/rails_root/vendor/plugins/bj/lib/orderedautohash.rb
exemplor-3000.3.0 vendor/orderedhash-0.0.6/lib/orderedautohash.rb
exemplor-3000.2.0 vendor/orderedhash-0.0.6/lib/orderedautohash.rb
exemplor-3000.1.0 vendor/orderedhash-0.0.6/lib/orderedautohash.rb
orderedhash-0.0.6 lib/orderedautohash.rb
orderedhash-0.0.4 lib/orderedautohash.rb