Symbol in Ruby

Mehdi Farsi
Sep 2, 2018 · 3 min read

What’s a Symbol in Ruby?

The Symbol class

irb> Symbol.new
NoMethodError (undefined method `new' for Symbol:Class)
irb> :dummy_symbol.class
=> Symbol
irb> Symbol.ancestors
=> [Symbol, Comparable, Object, Kernel, BasicObject]

Symbols behind the scene

ONE MORE THING ⬇

Feel free to subscribe here: www.rubycademy.com


rubycademy

E-Learning platform for Ruby and Ruby on Rails

Mehdi Farsi

Written by

Founder of www.rubycademy.com — I blog about Ruby & ROR - Paris

rubycademy

E-Learning platform for Ruby and Ruby on Rails