Commit 3d6974da authored by Mayel's avatar Mayel

cleanup

parent e5ee33bf
Pipeline #218994404 failed with stage
in 1 minute and 3 seconds
# module that we will override
alias CommonsPub.Utils.Simulation, as: NewModule
# new name for the old module
alias Original.CommonsPub.Utils.Simulation, as: ArchiveModule
# start by archiving the old module
Modularity.Module.Override.clone(CommonsPub.Utils.Simulation, Original.CommonsPub.Utils.Simulation)
# archive the old module
Modularity.Module.Override.clone(NewModule, ArchiveModule)
defmodule NewModule do
defmodule CommonsPub.Utils.Simulation do
require Modularity.Module.Extend
alias Original.CommonsPub.Utils.Simulation, as: Original
# extend the archived module
Modularity.Module.Extend.extends ArchiveModule
Modularity.Module.Extend.extends Original
####
# (Re)define new or existing functions
# Redefine existing functions, or add new ones:
####
# example of straight up replacing a function
def name(), do: Faker.Person.last_name()
# example of modifying the input of a function
# def maybe_one_of(list), do: list ++ [""] |> ArchiveModule.maybe_one_of()
# def maybe_one_of(list), do: list ++ [""] |> Original.maybe_one_of()
# example of modifying the output of a function
def location(), do: ArchiveModule.location() |> String.replace(",", " -")
def location(), do: Original.location() |> String.replace(",", " -")
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment