Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Update types
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwinchester committed Oct 14, 2020
1 parent 48c693f commit afe0095
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/uuid.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule UUID do
@type type :: :default | :raw | :hex | :urn | :slug

@typedoc "UUID version."
@type version :: 1 | 3 | 4 | 5
@type version :: 1 | 3 | 4 | 5 | 6

@typedoc "Variant of UUID: see RFC for the details."
@type variant ::
Expand Down
12 changes: 7 additions & 5 deletions lib/uuid/info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ defmodule UUID.Info do

defstruct [:uuid, :binary, :type, :version, :variant]

@type type :: :default | :hex | :urn | :raw | :slug
@type version :: 1 | 3 | 4 | 5 | 6
@type variant :: :rfc4122 | :reserved_ncs | :reserved_microsoft | :reserved_future
@type t :: %Info{uuid: binary, type: type, version: version, variant: variant}
@type t :: %Info{
uuid: UUID.t(),
type: UUID.type(),
version: UUID.version(),
variant: UUID.variant()
}

@doc """
Inspect a UUID and return tuple with `{:ok, result}`, where result is
Expand Down Expand Up @@ -177,7 +179,7 @@ defmodule UUID.Info do
** (ArgumentError) Invalid argument; Not valid variant bits
"""
@spec variant(binary) :: variant
@spec variant(binary) :: UUID.variant()
def variant(<<1, 1, 1>>), do: :reserved_future
def variant(<<1, 1, _v>>), do: :reserved_microsoft
def variant(<<1, 0, _v>>), do: :rfc4122
Expand Down

0 comments on commit afe0095

Please sign in to comment.