From: Ronald Fischer Date: 2007-08-07T18:09:36+09:00 Subject: Re: Feature request (pretty_inspect variant, yielding single quotes instead of double) > You would have to also explain how embedded control characters will be > printed because there is no way I know of at the moment that would > allow to embed e.g. a newline in a single quote string: Good point. I overlooked this. But there are easy workarounds. For example, pretty_inspectq could revert to double quotation if the string to be printed can not be formatted using single quotes. Or (remember that I don't want to change the default behaviour of pretty_inspect) an exception is thrown in this case, which makes sense: The user requests pretty_inspecting in single quotes, but if it is not possible, we should blame the user. > If you introduce a new syntax Certainly not! I don't want to open *that* can of worms. > Btw, there is another variant for switching between single and double > quotes: you can use a global variable. This has the advantage that > you do not need to touch any #inspect implementation of custom classes > - but comes at a price of course. Hmmmmm.... here I don't see the point. In my case, I use pretty_inspect to "marshal" Ruby data types (they are written to a file, which is then edited by the user, and finally eval'ed by another Ruby application). I use pretty_inspect to easily format Ruby structures (arrays...), but for the user, it is more convenient to use single quoted strings when editing the data, because he needs to care less about escaping rules. Ronald