Current section
27 Versions
Jump to
Current section
27 Versions
Compare versions
4
files changed
+36
additions
-12
deletions
| @@ -30,3 +30,10 @@ config :logger, | |
| 30 30 | |
| 31 31 | For more information on how to use `Ink`, take a look |
| 32 32 | at [the docs](https://hexdocs.pm/ink/Ink.html). |
| 33 | + |
| 34 | + ## Maintenance |
| 35 | + |
| 36 | + - get dependencies with `mix deps.get` |
| 37 | + - execute tests with `mix test` |
| 38 | + - update dependencies with `mix deps.update --all` |
| 39 | + - execute tests again `mix test` |
| @@ -4,15 +4,15 @@ | |
| 4 4 | <<"A backend for the Elixir Logger that logs JSON and can filter sensitive data.">>}. |
| 5 5 | {<<"elixir">>,<<"~> 1.4">>}. |
| 6 6 | {<<"files">>, |
| 7 | - [<<"lib">>,<<"lib/.DS_Store">>,<<"lib/ink">>,<<"lib/ink.ex">>, |
| 8 | - <<"lib/ink/encoder.ex">>,<<"mix.exs">>,<<"README.md">>]}. |
| 7 | + [<<"lib">>,<<"lib/ink">>,<<"lib/ink/encoder.ex">>,<<"lib/.DS_Store">>, |
| 8 | + <<"lib/ink.ex">>,<<"mix.exs">>,<<"README.md">>]}. |
| 9 9 | {<<"licenses">>,[<<"MIT">>]}. |
| 10 10 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/ivx/ink">>}]}. |
| 11 11 | {<<"name">>,<<"ink">>}. |
| 12 12 | {<<"requirements">>, |
| 13 | - [[{<<"app">>,<<"poison">>}, |
| 14 | - {<<"name">>,<<"poison">>}, |
| 13 | + [[{<<"app">>,<<"jason">>}, |
| 14 | + {<<"name">>,<<"jason">>}, |
| 15 15 | {<<"optional">>,false}, |
| 16 16 | {<<"repository">>,<<"hexpm">>}, |
| 17 | - {<<"requirement">>,<<"~> 2.2 or ~> 3.1">>}]]}. |
| 18 | - {<<"version">>,<<"0.8.1">>}. |
| 17 | + {<<"requirement">>,<<"~> 1.1">>}]]}. |
| 18 | + {<<"version">>,<<"0.9.0">>}. |
| @@ -1,8 +1,18 @@ | |
| 1 1 | defmodule Ink.Encoder do |
| 2 | + @moduledoc """ |
| 3 | + Responsible for encoding any value to JSON. Uses `Poison` for the JSON |
| 4 | + encoding, but converts values that are not handled by `Poison` before that, |
| 5 | + like tuples or PIDs. |
| 6 | + """ |
| 7 | + |
| 8 | + @doc """ |
| 9 | + Accepts a map and recursively replaces all JSON incompatible values with JSON |
| 10 | + encodable values. Then converts the map to JSON. |
| 11 | + """ |
| 2 12 | def encode(map) do |
| 3 13 | map |
| 4 14 | |> encode_value |
| 5 | - |> Poison.encode() |
| 15 | + |> Jason.encode() |
| 6 16 | end |
| 7 17 | |
| 8 18 | defp encode_value(value) |
| @@ -4,13 +4,20 @@ defmodule Ink.Mixfile do | |
| 4 4 | def project do |
| 5 5 | [ |
| 6 6 | app: :ink, |
| 7 | - version: "0.8.1", |
| 7 | + version: "0.9.0", |
| 8 8 | elixir: "~> 1.4", |
| 9 9 | build_embedded: Mix.env() == :prod, |
| 10 10 | start_permanent: Mix.env() == :prod, |
| 11 11 | description: description(), |
| 12 12 | package: package(), |
| 13 | - deps: deps() |
| 13 | + deps: deps(), |
| 14 | + name: "Ink", |
| 15 | + source_url: "https://github.com/ivx/ink", |
| 16 | + homepage_url: "https://github.com/ivx/ink", |
| 17 | + docs: [ |
| 18 | + main: "Ink", |
| 19 | + extras: ["README.md"] |
| 20 | + ] |
| 14 21 | ] |
| 15 22 | end |
| 16 23 | |
| @@ -49,9 +56,9 @@ defmodule Ink.Mixfile do | |
| 49 56 | # Type "mix help deps" for more examples and options |
| 50 57 | defp deps do |
| 51 58 | [ |
| 52 | - {:poison, "~> 2.2 or ~> 3.1"}, |
| 53 | - {:inch_ex, "~> 0.5", only: :docs}, |
| 54 | - {:credo, "~> 0.7", only: [:dev, :test]}, |
| 59 | + {:jason, "~> 1.1"}, |
| 60 | + {:inch_ex, "~> 2.0", only: :docs}, |
| 61 | + {:credo, "~> 1.0", only: [:dev, :test]}, |
| 55 62 | {:ex_doc, ">= 0.0.0", only: :dev} |
| 56 63 | ] |
| 57 64 | end |