lib/hashery/dictionary.rb in hashery-1.4.0 vs lib/hashery/dictionary.rb in hashery-1.5.0
- old
+ new
@@ -122,10 +122,12 @@
else
@hash = Hash.new(*args)
end
end
+ #
+
def order
reorder if @order_by
@order
end
@@ -174,9 +176,10 @@
order
self
end
#
+
def reorder
if @order_by
assoc = @order.collect{ |k| [k,@hash[k]] }.sort_by(&@order_by)
@order = assoc.collect{ |k,v| k }
end