Skip to content

Instantly share code, notes, and snippets.

@mrkaspa
Last active March 4, 2016 13:40
Show Gist options
  • Save mrkaspa/6daed95d41a842c5996f to your computer and use it in GitHub Desktop.
Save mrkaspa/6daed95d41a842c5996f to your computer and use it in GitHub Desktop.
#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