diff options
author | elijah <elijah@riseup.net> | 2014-11-24 22:45:27 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-11-24 22:45:27 -0800 |
commit | b839376a507e37a048ea2df53127ed0884310f60 (patch) | |
tree | 68ba30a77c51a3ee1a2c9ddd7187e6743cff08f1 /lib/core_ext/yaml.rb | |
parent | 8450768268c2bdf82cd6d6bfa9972c70bc5cdcac (diff) | |
download | leap_cli-develop.tar.gz leap_cli-develop.tar.bz2 |
moved core_ext and lib_ext under leap_clidevelop
Diffstat (limited to 'lib/core_ext/yaml.rb')
-rw-r--r-- | lib/core_ext/yaml.rb | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/lib/core_ext/yaml.rb b/lib/core_ext/yaml.rb deleted file mode 100644 index bb0b5c9..0000000 --- a/lib/core_ext/yaml.rb +++ /dev/null @@ -1,29 +0,0 @@ -class Object - # - # ya2yaml will output hash keys in sorted order, but it outputs arrays - # in natural order. This new method, sorted_ya2yaml(), is the same as - # ya2yaml but ensures that arrays are sorted. - # - # This is important so that the .yaml files don't change each time you recompile. - # - # see https://github.com/afunai/ya2yaml/blob/master/lib/ya2yaml.rb - # - def sorted_ya2yaml(options = {}) - # modify array - Array.class_eval do - alias_method :collect_without_sort, :collect - def collect(&block) - sorted = sort {|a,b| a.to_s <=> b.to_s} - sorted.collect_without_sort(&block) - end - end - - # generate yaml - yaml_str = self.ya2yaml(options) - - # restore array - Array.class_eval {alias_method :collect, :collect_without_sort} - - return yaml_str - end -end |