Sha256: 36d3aeea71e5abdc14a98c6c92daf3ed72ae741de2b0ef210bf825e69e698ed6

Contents?: true

Size: 348 Bytes

Versions: 14

Compression:

Stored size: 348 Bytes

Contents

require 'yaml'

class Hash

  def to_yaml(opts = {})
    YAML::quick_emit(object_id, opts) do |out|
      out.map(taguri, to_yaml_style) do |map|
        sorted = self.sort { |a, b| a[0] <=> b[0] }
        sorted.each { |k, v| map.add(k, v) }
      end
    end
  end

end

class Symbol
  
  def <=>(other)
    self.to_s <=> other.to_s
  end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
datacatalog-importer-0.1.13 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.12 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.11 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.10 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.9 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.8 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.7 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.6 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.5 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.4 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.3 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.2 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.1 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.0 lib/sort_yaml_hash.rb