summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2011-02-28 16:37:22 -0800
committerMatt Robinson <matt@puppetlabs.com>2011-02-28 17:10:58 -0800
commit8cc390caa18e3b536869f0591d529d8ade76fc49 (patch)
tree2a338d0a499f633c7081a275d18e10777660d4a7
parent24eacb7fe6696a8c049b08ec382c5d1ab114ce67 (diff)
downloadpuppet-8cc390caa18e3b536869f0591d529d8ade76fc49.tar.gz
puppet-8cc390caa18e3b536869f0591d529d8ade76fc49.tar.xz
puppet-8cc390caa18e3b536869f0591d529d8ade76fc49.zip
(#5466) Monkey patch Symbol so that you can sort them
It turns out that the ability to sort symbols comes in the preinit section of application run when we load Facter and hit the code that adds the <=> method for symbols in lib/facter/util/plist/generator.rb Reviewed-by: Nick Lewis <nick@puppetlabs.com>
-rw-r--r--lib/puppet/util/monkey_patches.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb
index 85854a04c..16384855a 100644
--- a/lib/puppet/util/monkey_patches.rb
+++ b/lib/puppet/util/monkey_patches.rb
@@ -21,6 +21,9 @@ class Symbol
z.emit("!ruby/sym ")
to_s.to_zaml(z)
end
+ def <=> (other)
+ self.to_s <=> other.to_s
+ end
end
[Object, Exception, Integer, Struct, Date, Time, Range, Regexp, Hash, Array, Float, String, FalseClass, TrueClass, Symbol, NilClass, Class].each { |cls|