Question

Where are these symbols defined, and what are they used for?

:w2_end
:w2_beg
:w1_beg
:w1_end

I found those in my IRB by using the line Symbol.all_symbols .

My Ruby version and IRB versions are:

C:\>ruby -v
ruby 1.9.3p374 (2013-01-15) [i386-mingw32]

C:\>irb --version
irb 0.9.6(09/06/30)

I tried the same in another Ruby and IRB version as below:

C:\>irb --version
irb 0.9.6(09/06/30)

C:\>ruby -v
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]

Arr = Symbol.all_symbols 
Arr.include?(:w2_end) #=> true
Arr.include?(:w2_beg) #=> true
Arr.include?(:w1_beg) #=> true
Arr.include?(:w1_end) #=> true
Was it helpful?

Solution

These symbols don't appear in the Ruby source, nor are they defined when I look for them:

$ rvm 1.9.3-p374 do irb
1.9.3p374 :003 > Symbol.all_symbols.map(&:to_s).grep(/^w\d/)
 => [] 

Have you got your irb configured to load any extensions? Look in your .irbrc, if you have one.

Those symbols are commonly found in, among other places, readline libraries. irb uses readline. Perhaps there's something special about readline on Windows (it being coded in Ruby, for example) that causes those symbols to be defined.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top