lib/braid/config.rb in dreamcat4-braid-0.531 vs lib/braid/config.rb in dreamcat4-braid-0.533
- old
+ new
@@ -1,7 +1,21 @@
require 'yaml'
require 'yaml/store'
+class Hash
+ # Replacing the to_yaml function so it'll serialize hashes sorted (by their keys)
+ # Original function is in /usr/lib/ruby/1.8/yaml/rubytypes.rb
+ def to_yaml( opts = {} )
+ YAML::quick_emit( object_id, opts ) do |out|
+ out.map( taguri, to_yaml_style ) do |map|
+ sort.each do |k, v| # <-- here's my addition (the 'sort')
+ map.add( k, v )
+ end
+ end
+ end
+ end
+end
+
module Braid
class Config
class PathAlreadyInUse < BraidError
def message
"path already in use: #{super}"