mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
quote symbols
* sprintf.c (ruby__sfvextra): quote symbols as identifiers. * string.c (rb_id_quote_unprintable): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
251c7892c1
commit
c05fa459bb
3 changed files with 14 additions and 2 deletions
|
@ -1378,6 +1378,12 @@ ruby__sfvextra(rb_printf_buffer *fp, size_t valsize, void *valp, long *sz, int s
|
|||
}
|
||||
value = rb_inspect(value);
|
||||
}
|
||||
else if (SYMBOL_P(value)) {
|
||||
value = rb_sym2str(value);
|
||||
if (sign == ' ' && !rb_str_symname_p(value)) {
|
||||
value = rb_str_inspect(value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
value = rb_obj_as_string(value);
|
||||
if (sign == ' ') value = QUOTE(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue