Packages

ExRPG is a general utility for tabletop role-playing games.

Current section

Files

Jump to
ex_rpg lib rule_systems abilities spec.ex
Raw

lib/rule_systems/abilities/spec.ex

defmodule ExRPG.RuleSystems.Abilities.Spec do
alias ExRPG.RuleSystems.Abilities.Spec
@moduledoc """
A spec is the base definition of an ability, defining its name, abbreviation,
and description. Additionally this module provides helper methods for
individual specs and lists of specs.
"""
defstruct [:name, :abbreviation, :description]
@doc """
Retunes the names of the given specs
## Examples
iex> ExRPG.RuleSystems.Abilities.Spec.get_names(list_of_specs)
["names", "of", "specs]
"""
def get_names([%Spec{} | _tail] = specs) do
Enum.reduce(specs, [], fn spec, acc -> [spec.name | acc] end)
end
end