Created
August 14, 2019 16:40
-
-
Save nmquebb/4de3bc77542d0f6346aea2838b3ba7f9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Animals do | |
| alias Animals.{Cat, Dog, Bear} | |
| def get_module("cat"), do: Cat | |
| def get_module("dog"), do: Dog | |
| def get_module("bear"), do: Bear | |
| def do_this(model), | |
| do: apply(get_module(model.type), :validate_structure, [model]) | |
| def do_that(model, folder), | |
| do: apply(get_module(model.type), :create_folder, [model]) | |
| def do_other(model, folder), | |
| do: apply(get_module(model.type), :update_folder, [model]) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment