Issue #12275 has been updated by tad (Tadashi Saito).

File benchmark2.rb added
File v2.patch added

I updated patch as v2.patch to satisfy 3 points that mentioned in [note-15](https://bugs.ruby-lang.org/issues/12275#note-15).
(Also https://github.com/ruby/ruby/pull/1765 is updated too.)

I also attached a simple benchmarking script as benchmark2.rb to check performance of newly-supported `"...".force_encoding("...")` form.

Can anyone review this patch?  Or @naruse, do you want to nominate somebody?

----------------------------------------
Feature #12275: String unescape
https://bugs.ruby-lang.org/issues/12275#change-68246

* Author: asnow (Andrew Bolshov)
* Status: Assigned
* Priority: Normal
* Assignee: tad (Tadashi Saito)
* Target version: 
----------------------------------------
I think it will be usefull to have function that convert input string as it was written in prime qouted string or in double qouted string. It's part of metaprogramming.
Example:

~~~ ruby
class String
  # Create new string like it will be writed in qoutes. Optional argument define type of qouting used: true - prime qoute, false - double qoute. Default is double qoute.
  def unescape prime = false
    eval( prime ? "'#{self}'" : "\"#{self}\"" )
  end
end

"\\\t".unescape # => "\t"
~~~

Other requests:
http://www.rubydoc.info/github/ronin-ruby/ronin-support/String:unescape
http://stackoverflow.com/questions/4265928/how-do-i-unescape-c-style-escape-sequences-from-ruby
http://stackoverflow.com/questions/8639642/best-way-to-escape-and-unescape-strings-in-ruby

Realized
http://www.rubydoc.info/github/ronin-ruby/ronin-support/String:unescape

---Files--------------------------------
benchmark.rb (193 Bytes)
v1.patch (8.95 KB)
benchmark2.rb (315 Bytes)
v2.patch (12.1 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>