Last active
March 4, 2016 13:40
-
-
Save mrkaspa/6daed95d41a842c5996f 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
| #Add the library to your dependencies | |
| def deps do | |
| [{:mutant, "~> 0.0.2"}] | |
| end | |
| #create a module and use the Mutant module passing the fields | |
| defmodule MyMutant do | |
| use Mutant, name: "" | |
| end | |
| #create a new mutant | |
| mutant = MyMutant.new(name: "demo") | |
| #generates a get for the field | |
| MyMutant.get_name(mutant) #=> "demo" | |
| #generates a set for the field | |
| MyMutant.set_name(mutant, "new") | |
| #the state has been changed | |
| MyMutant.get_name(mutant) #=> "new" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment