Skip to content

Commit 92131b6

Browse files
committed
Pass namespace to XML.build
1 parent 680ca7a commit 92131b6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/sassone/builder.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ defimpl Sassone.Builder, for: Any do
153153
unquote(end_element)
154154

155155
def attributes(_t), do: unquote(Macro.escape(attributes))
156-
def build(t), do: XML.build(t, Builder.root_element(t))
156+
def build(t), do: XML.build(t, Builder.namespace(t), Builder.root_element(t))
157157
def elements(_t), do: unquote(Macro.escape(elements))
158158
def handler(_t), do: __MODULE__
159159
def namespace(_t), do: unquote(options[:namespace])

lib/sassone/xml.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ defmodule Sassone.XML do
9696

9797
@doc "Builds a struct deriving `Sassone.Builder` for encoding with `Sassone.encode!/2`"
9898
@spec build(Builder.t(), name()) :: element()
99-
def build(struct, element_name) do
99+
def build(struct, namespace \\ nil, element_name) do
100100
attributes =
101101
Builder.attributes(struct)
102102
|> Enum.reduce([], &build_attributes(struct, &1, &2))
@@ -107,7 +107,7 @@ defmodule Sassone.XML do
107107
|> Enum.reduce([], &build_elements(struct, &1, &2))
108108
|> Enum.reverse()
109109

110-
element(Builder.namespace(struct), element_name, attributes, elements)
110+
element(namespace, element_name, attributes, elements)
111111
end
112112

113113
defp build_attributes(_struct, %Field{build: false}, attributes),

0 commit comments

Comments
 (0)