Created
February 27, 2014 16:51
-
-
Save martinpovolny/9254114 to your computer and use it in GitHub Desktop.
why don't we have .to_sym_if_exists in ruby? same as erlang has? http://www.erlang.org/doc/man/erlang.html#binary_to_existing_atom-2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(3)> :erlang.binary_to_existing_atom("foobar", :utf8) | |
** (ArgumentError) argument error | |
:erlang.binary_to_existing_atom("foobar", :utf8) | |
iex(3)> :foobar | |
:foobar | |
iex(4)> :erlang.binary_to_existing_atom("foobar", :utf8) | |
:foobar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment