- abc: it can’t exist independently
- :xyz it is a symbol
:xyz.class => Symbol 3) abc::xyz it represents namespace
Example code:
module ABC class Xyz def initialize @size = 400 end end end
x = ABC::Xyz.new 4) abc: :xyz
hash = {abc: :xyz} #hash key and value all are symbol. 5) abc: xyz
xyz = “just a test” hash = {abc: xyz} #hash key is symbol, value is string. 6) :abc => xyz
xyz = “just a test” hash = {:abc => xyz} # same with (5), just another representation 7) ternary operator :
abc = 1 xyz = 2 result = abc > xyz ? abc : xyz => result = 2
– Copy from http://stackoverflow.com/questions/30315021/colon-placement-in-ruby-on-rails/30315118#30315118