only one copy of symbol  

irb(main):001:0> "string".object_id == "string".object_id
=> false
irb(main):002:0> :string.object_id == :string.object_id
=> true

The .object_id method gets the ID of an object—it’s how Ruby knows whether two objects are the exact same object.

irb(main):002:0> string = "string"
=> "string"
irb(main):003:0> string.object_id == "string".object_id
=> false
irb(main):004:0> string = :string
=> :string
irb(main):005:0> string.object_id == :string.object_id
=> true
 
0
Kudos
 
0
Kudos

Now read this

Ruby block

I’ve been trying to figure out how it works. This morning I wanted to write it down my thinking process today, before I forget. block_given? block_given? is a method of Kernel module. In other words, it’s one of the same kind of puts,... Continue →