Created
July 7, 2021 23:59
-
-
Save joeljuca/9cfa77b2c19962bd3d5b0fb9e8517e27 to your computer and use it in GitHub Desktop.
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
defmodule Sorteio do | |
@moduledoc false | |
@people """ | |
Fernando Collor | |
Fernando Henrique Cardoso | |
Luiz da Silva | |
""" | |
def people do | |
@people | |
|> String.split("\n") | |
|> Enum.map(&String.trim/1) | |
|> Enum.filter(&(String.length(&1) != 0)) | |
end | |
def sortear do | |
people() | |
|> Enum.random() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment