Permalink
Browse files

Sort hash keys in YAML output

  • Loading branch information...
1 parent a2e1320 commit 2cb07bb3a92791bffc743dc568417ab12b9222ad @norbert norbert committed Jan 23, 2009
Showing with 16 additions and 2 deletions.
  1. +3 −2 lib/braid.rb
  2. +13 −0 lib/core_ext.rb
View
@@ -1,4 +1,4 @@
-$:.unshift File.dirname(__FILE__)
+$:.unshift dirname = File.dirname(__FILE__)
module Braid
VERSION = "0.5"
@@ -20,10 +20,11 @@ def message
end
end
+require dirname + '/core_ext'
require 'braid/operations'
require 'braid/mirror'
require 'braid/config'
require 'braid/command'
-Dir[File.dirname(__FILE__) + '/braid/commands/*'].each do |file|
+Dir[dirname + '/braid/commands/*'].each do |file|
require file
end
View
@@ -0,0 +1,13 @@
+require 'yaml'
+
+class Hash
+ 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|
+ map.add(k, v)
+ end
+ end
+ end
+ end
+end

0 comments on commit 2cb07bb

Please sign in to comment.