Sha256: 81703abe2814656f27a0c48072bbbb51247af1f05736fb97fd0889bfbfb66078

Contents?: true

Size: 563 Bytes

Versions: 11

Compression:

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

11 entries across 11 versions & 1 rubygems

Version Path
ridgepole-0.7.0.beta15 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta14 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta13 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta12 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta11 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta10 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta9 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta8 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta7 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta6 lib/ridgepole/ext/pp_sort_hash.rb
ridgepole-0.7.0.beta5 lib/ridgepole/ext/pp_sort_hash.rb