[Solved] result of passing a symbol to method [closed]


Symbol#empty is basically defined as self.to_s.empty? (with self being the symbol).

So to answer your question why :"".empty? is true: It is because :"".to_s (the empty string) is empty.

To adress your comment: :any_symbol.empty? is false, because :any_symbol.to_s.empty? is false. It’s the same thing. Maybe empty? is not the method you are looking for. Maybe I just didn’t get what you are asking.

4

solved result of passing a symbol to method [closed]