Sha256: b164204d20bc8288ddc7c05e63d2c5ad40dd0e23e6284463c17d03831c290d6a
Contents?: true
Size: 609 Bytes
Versions: 18
Compression:
Stored size: 609 Bytes
Contents
module Ridgepole module Ext module PpSortHash def pretty_print(q) q.group(1, '{', '}') { q.seplist(self.sort_by {|k, _| k.to_s } , nil, :each) {|k, v| v = PpSortHash.extend_if_hash(v) q.group { q.pp k q.text '=>' q.group(1) { q.breakable '' q.pp v } } } } end def self.extend_if_hash(obj) if obj.kind_of?(Hash) obj = obj.dup obj.extend(self) end obj end end end end
Version data entries
18 entries across 18 versions & 1 rubygems