Skip to content

Commit

Permalink
move the list option into the Protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
davemenninger committed Oct 20, 2021
1 parent 8ab3de1 commit 42b1089
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/poison.ex
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ defmodule Poison do
Parser.parse!(value, %{})
end

@spec decode!(iodata, Decoder.options() | [Decoder.option()]) :: Decoder.t() | no_return
@spec decode!(iodata, Decoder.options()) :: Decoder.t() | no_return
def decode!(value, options) when is_list(options) do
decode!(value, Map.new(options))
end
Expand Down
12 changes: 7 additions & 5 deletions lib/poison/decoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ defprotocol Poison.Decoder do
@typep as :: map | struct | [as]

@type option :: {:keys, :atoms | :atoms!} | {:decimal, boolean} | {:as, as}
@type options :: %{
optional(:keys) => :atoms | :atoms!,
optional(:decimal) => boolean,
optional(:as) => as
}
@type options ::
%{
optional(:keys) => :atoms | :atoms!,
optional(:decimal) => boolean,
optional(:as) => as
}
| [option]

@spec decode(t, options) :: any
def decode(value, options)
Expand Down

0 comments on commit 42b1089

Please sign in to comment.