nTraum / struct_fields

Tiny Elixir module to easily get a list of fields for structs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StructFields

Build Status Hex.pm

Tiny module to easily get a list of fields for structs.

Example

defmodule MyModule do
  use StructFields

  defstruct [:foo, :bar]
end

MyModule.fields
#=> [:bar, :foo]

Installation

  1. Add struct_fields to your list of dependencies in mix.exs:
def deps do
  [{:struct_fields, "~> 0.2.0"}]
end
  1. Ensure struct_fields is started before your application:
def application do
  [applications: [:struct_fields]]
end

Documentation

http://hexdocs.pm/struct_fields

About

Tiny Elixir module to easily get a list of fields for structs.

License:MIT License


Languages

Language:Elixir 100.0%