Skip to content

Commit

Permalink
remove bag
Browse files Browse the repository at this point in the history
  • Loading branch information
jackalcooper committed Sep 3, 2024
1 parent 297e6f2 commit 3b6df92
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions lib/resource_kind.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,25 @@ defmodule Kinda.ResourceKind do
fields = Keyword.get(opts, :fields) || []
gen_spec = Keyword.get(opts, :gen_spec, true)

quote bind_quoted: [
forward_module: forward_module,
fields: fields,
gen_spec: gen_spec
] do
defstruct [ref: nil, bag: MapSet.new()] ++ fields

spec =
if gen_spec do
@type t() :: %__MODULE__{}
quote do
@type t() :: %__MODULE__{}
end
end

quote do
defstruct [ref: nil] ++ unquote(fields)

unquote(spec)

def make(value) do
%__MODULE__{
ref: unquote(forward_module).forward(__MODULE__, "make", [value])
}
end

defoverridable(make: 1)
end
end
end

0 comments on commit 3b6df92

Please sign in to comment.