Sha256: 4ebc0a5ce5c24b4649676a4690905a166cf2590716002b8419cfa1b4d6c2e2ac

Contents?: true

Size: 376 Bytes

Versions: 1

Compression:

Stored size: 376 Bytes

Contents

require "pp_sort_hash/version"

module PpSortHash
  def pretty_print(q)
    q.group(1, '{', '}') {
      q.seplist(self.sort_by {|k, _| k.to_s } , nil, :each) {|k, v|
        q.group {
          q.pp k
          q.text '=>'
          q.group(1) {
            q.breakable ''
            q.pp v
          }
        }
      }
    }
  end
end

class Hash
  prepend PpSortHash
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pp_sort_hash-0.1.0 lib/pp_sort_hash.rb