Commit Graph

8 Commits

Author SHA1 Message Date
Martin Frost 933c15a671 Some tidying up 2015-10-03 21:45:47 +02:00
Martin Frost 68967b1e63 Comment Ecto.Type module generating code 2015-10-02 20:45:53 +02:00
Martin Frost 0f89e38df3 Properly indent Isn module documentation 2015-10-02 20:43:59 +02:00
Martin Frost 489a461b34 Rewrite Ecto module implementation
Replace Isn.Base and its gigantic `__using__` method with a simple for
comprehension to generate all of the separate modules instead.
2015-10-02 20:24:50 +02:00
Martin Frost e012413a35 Explicitly `unquote(isn_type)` in Isn.Base
This gets rid of `@isn_type` in Isn.Base. It was only ever there because I had
to store it somewhere, since compile-time macro parameters are not available to
a function at runtime.
2015-06-10 08:24:24 +02:00
Martin Frost 15385bfc6b Use __CALLER__ to determine isn datatype
`__CALLER__.module` contains enough information to determine what datatype to
use, so the usage of `Isn.Base` can be simplified to the following

```elixir
defmodule Isn.ISBN13 do
  use Isn.Base
end
```

instead of

```elixir
defmodule Isn.ISBN13 do
  use Isn.Base, :isbn13
end
```
2015-06-02 08:03:17 +02:00
Martin Frost c0eb9ec41f Added better documentation. 2015-05-27 19:38:26 +02:00
Martin Frost ba23be86bb v0.1: Flesh out library with all types in isn
Restructuring: Isn.Extension is now called Isn, which means that the postgrex
configuration line becomes a bit shorter now:

```elixir
{:ok, pid} = Postgrex.Connection.start_link(
  database: "isn_test",
  extensions: [{Isn, {}}])
```

instead of the previous version, with `extensions: [{Isn.Extension, {}}]`.

I also implement the entire library in the `lib/isn.ex` file, since it felt
pretty silly to have eight different one-line files under `lib/isn/` looking
like this: `defmodule Isn.ISBN, do: use(Isn.Base, :isbn)`

We now have the following types:

- ISBN
- ISBN13
- ISMN
- ISMN13
- ISSN
- ISSN13
- EAN13
- UPC
2015-05-27 18:22:51 +02:00