From: Aaron Patterson Date: 2013-08-11T13:56:11+09:00 Subject: [ruby-core:56540] Re: [ruby-trunk - Feature #8765][Open] Literal for symbol with interpolation On Sat, Aug 10, 2013 at 10:59:24PM +0900, sawa (Tsuyoshi Sawada) wrote: > > Issue #8765 has been reported by sawa (Tsuyoshi Sawada). > > ---------------------------------------- > Feature #8765: Literal for symbol with interpolation > https://bugs.ruby-lang.org/issues/8765 > > Author: sawa (Tsuyoshi Sawada) > Status: Open > Priority: Normal > Assignee: > Category: > Target version: > > > =begin > I propose a symbol literal `%S` with interpolation > > foo = 3 > %s{#{foo}} # => :"\#{foo}" > %S{#{foo}} # => :"3" > > The conventional `:""` literal looks as if it is a unary operator to a string. Since there are both `%q` and `%Q` literals for string, I don't see any reason why symbols only have `%s`. irb(main):001:0> RUBY_VERSION => "2.0.0" irb(main):002:0> foo = 3 => 3 irb(main):003:0> %i{#{foo}} => [:"\#{foo}"] irb(main):004:0> %I{#{foo}} => [:"3"] irb(main):005:0> -- Aaron Patterson http://tenderlovemaking.com/