Sha256: 240ad560f8cf856a1fc4d7faa85daedaa9f815346eea7ce482447ed926b26e4d

Contents?: true

Size: 340 Bytes

Versions: 12

Compression:

Stored size: 340 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

12 entries across 12 versions & 1 rubygems

Version Path
datacatalog-importer-0.3.1 lib/sort_yaml_hash.rb
datacatalog-importer-0.3.0 lib/sort_yaml_hash.rb
datacatalog-importer-0.2.3 lib/sort_yaml_hash.rb
datacatalog-importer-0.2.2 lib/sort_yaml_hash.rb
datacatalog-importer-0.2.1 lib/sort_yaml_hash.rb
datacatalog-importer-0.2.0 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.19 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.18 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.17 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.16 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.15 lib/sort_yaml_hash.rb
datacatalog-importer-0.1.14 lib/sort_yaml_hash.rb