> ## Content Index
> Fetch the complete content index at: https://www.frank.be/llms.txt
> Use this file to discover other available public pages before exploring further.

# Ruby WTF?!
- URL: https://www.frank.be/ruby-wtf-2/
- Published: 2017-05-11T10:30:58.000Z
- Updated: 2026-06-21T17:37:26.000Z
- Author: Frank Louwers
- Tags: wtf, ruby

The second law of [Kris Buytaert](http://www.krisbuytaert.be/?ref=frank.be) states that the number of WTF's per second, is the most important metric to chart...

If we would do that, the chart would have been steeper than the rise of the Bitcoin the last few days.

Watch this:

```
irb(main):001:0> s="this_is_an_example"
=> "this_is_an_example"
irb(main):002:0> s.sub(/_/,'\_')
=> "this\\_is_an_example"
irb(main):003:0> s.sub(/_/,"\_")
=> "this_is_an_example"
irb(main):004:0> s.sub(/_/,"\\_")
=> "this\\_is_an_example"
irb(main):005:0> s.sub(/_/,'\\_')
=> "this\\_is_an_example"
irb(main):006:0> f = '\_'
=> "\\_"
irb(main):007:0> f
=> "\\_"
irb(main):008:0> f.inspect
=> "\"\\\\_\""
irb(main):009:0> f = "\_"
=> "_"
irb(main):010:0> f.inspect
=> "\"_\""

```

[WTF Ruby?!](https://www.destroyallsoftware.com/talks/wat?ref=frank.be)

The answer is that what you see, is not some Ruby funkyness. It's `irb` playing tricks with your mind: irb always shows you the "inspect" output, which replaces certain characters in strings.

```
irb(main):015:0> rs = "a\\_second_example"
=> "a\\_second_example"
irb(main):016:0> puts rs
a\_second_example

```