Skip to content

Commit

Permalink
version up and support for optional types
Browse files Browse the repository at this point in the history
  • Loading branch information
ityonemo committed Jul 20, 2023
1 parent f6ae770 commit 38ac756
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The package can be installed by adding `zig_doc` to your list of dependencies in
```elixir
def deps do
[
{:zig_doc, "~> 0.1.1"}
{:zig_doc, "~> 0.1.2"}
]
end
```
Expand Down
6 changes: 6 additions & 0 deletions lib/zig.doc/generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ defmodule Zig.Doc.Generator do
"#{optional}[] #{const}#{render_type(params[:type])}"
end

defp render_type({:optional_type, {:ref, parts}}) do
parts
|> Enum.map(&to_string/1)
|> Enum.join(".")
end

defp render_type(type = %struct{}) do
case struct do
Zig.Type.Optional ->
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule ZigDoc.MixProject do
def project do
[
app: :zig_doc,
version: "0.1.1",
version: "0.1.2",
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"mox": {:hex, :mox, "1.0.2", "dc2057289ac478b35760ba74165b4b3f402f68803dd5aecd3bfd19c183815d64", [:mix], [], "hexpm", "f9864921b3aaf763c8741b5b8e6f908f44566f1e427b2630e89e9a73b981fef2"},
"nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"},
"pegasus": {:hex, :pegasus, "0.2.2", "b7dd35d39bee6332fbecbc5800d1431f97825410d531b8e98f6314a8ebaadecf", [:mix], [{:nimble_parsec, "~> 1.2", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "57d749b25c35a3ec9bd0c61dd7b8735033b74081c2c677323a9f8c008b0cd770"},
"zig_parser": {:hex, :zig_parser, "0.1.7", "062082451a6d3a28a48e81efcfc044e99573b26b5aec7e66b2fab16ff57a8528", [:mix], [{:pegasus, "~> 0.2.2", [hex: :pegasus, repo: "hexpm", optional: false]}], "hexpm", "25d74ef4293faacf89df503437fe717fe84d2819894699bc0d00074c37858716"},
"zig_parser": {:hex, :zig_parser, "0.1.8", "97f4c6ef6737201912e1062c69ac488c24d70411f48929ed566fbfba0b06e392", [:mix], [{:pegasus, "~> 0.2.2", [hex: :pegasus, repo: "hexpm", optional: false]}], "hexpm", "d4fb06b224ea47a9a5b50952d4b7a29d559879701b12df77f2721b46c1e90426"},
}

0 comments on commit 38ac756

Please sign in to comment.