Sometimes it's really useful, or let's say even necessary, to configure your function-level default values per environment. Now, without any further ado, here is how you do it: @default_tty 1000 * 60 def something(ttl \\ default_ttl()) do # do something end # Time to live (ttl) period (in milliseconds). defp default_ttl do Application.get_env(:myapp, :some_topic, @default_ttl) … Continue reading Configure function default values
Tag: General
How to join strings in Elixir?
Maybe you want to join two strings in a list with a space, build a comma separated string from a list of elements or just want to generally understand the options of combine strings in Elixir. This one is for you. As string manipulation is a big part of most developers it is crucial to … Continue reading How to join strings in Elixir?