title: Checking if symbol is present in the array with include?
body: <p>Trying Ruby with the help of <a href="https://github.com/edgecase/ruby_koans" rel="nofollow">Ruby Koans</a>. There is following test there:</p>
  
  <pre><code>def test_method_names_become_symbols
    symbols_as_strings = Symbol.all_symbols.map { |x| x.to_s }
    assert_equal __, symbols_as_strings.include?("test_method_names_become_symbols")
  end
  
  # THINK ABOUT IT:
  #
  # Why do we convert the list of symbols to strings and then compare
  # against the string value rather than against symbols?
  </code></pre>
  
  <p>I tried to do the same thing in the irb console and it returned <code>false</code> for the undefined method. But then I tried the same in some <code>test.rb</code> file and <code>true</code> was returned to both existing and unexisting methods.</p>
  
  <p>Sample code:</p>
  
  <pre><code>def test_method
  end
  symbols = Symbol.all_symbols.map { |x| x }
  puts symbols.include?(:test_method) # returns true in both cases
  puts symbols.include?(:test_method_nonexistant) # returns false in irb, true if executed directly
  </code></pre>
  
  <p>The questions are: why do we convert symbols to strings in such case and why there are different results in irb and normal file?</p>
  
  <p>Thanks!</p>