CanvasNative v1.0.3 Constructor

Constructs a struct from the given map, turning string keys into atoms where necessary.

Usage

iex> defmodule DocModule do
...>   defstruct foo: ""
...>   @type t :: %__MODULE__{foo: String.t}
...>   use Constructor
...> end
iex> DocModule.new(%{"foo" => "bar", baz: "qux"})
%{__struct__: ConstructorTest.DocModule, baz: "qux", foo: "bar"}

Summary

Functions

Get a key for a given key (convert it to an atom if necessary)

Functions

get_key(key)

Specs

get_key(String.t | atom) :: atom

Get a key for a given key (convert it to an atom if necessary).