How to get a list of available methods for my variable?

You have to change your mindset, as you don’t have here any objects and classes. To check the functions (not methods anymore) of the String, you should so something like this:

 String.module_info(:exports)

which returns you all the functions that are exposed for the usage (in Elixir world we have by default exposed functions, but in Erlang you have to export them explicitly, so that’s why the function accept such atom as argument).

To examine what type of the variable you have, it’s more tricky. You can always use i or IEx.Info.info :slight_smile:

4 Likes