Election (Vote v0.1.0) View Source
Link to this section Summary
Functions
Updates Election Struct, based on provided command.
Link to this section Functions
Specs
Updates Election Struct, based on provided command.
Parameters
- election: Election struct
- cmd: String based command. Each command can be shortened to what's shown
in parenthesis.
- (n)ame command updates the election name
- example: "n mayor"
- (a)dd command adds a new candidate
- example: "a Tina Fey"
- (v)ote command increments the vote count for each candidate
- example: "v 1"
- (q)uit command returns a quit atom
- example: "q"
- (n)ame command updates the election name
Returns Election
struct
Examples
iex> %Election{} |> Election.update("n Mayor")
%Election{name: "Mayor"}