Project

General

Profile

Actions

Feature #9445

open

Support emitting 1.9 Symbol keyword Hash syntax when pretty printing Hashes

Added by postmodern (Hal Brodigan) about 10 years ago. Updated about 10 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:60043]

Description

Ruby 1.9 first introduced support for keyword Hash syntax for simple Symbol keys. However, Hash#inspect and pp do not emit the same syntax when printing Symbol keys. This patch adds support for "foo: " syntax to the pp_hash method, iff the key is a Symbol and does not contain any spaces or special characters. While the patch is probably not perfect, I hope to start a discussion.


Files

pp.patch (529 Bytes) pp.patch Patches the pp_hash method to emit "foo: " syntax for Symbol Hash keys postmodern (Hal Brodigan), 01/24/2014 02:11 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0