From 9fa39fab03c47f7aa65b2757eeb3718f1742da8e Mon Sep 17 00:00:00 2001 From: Josh Nussbaum Date: Thu, 4 Jun 2015 08:31:09 -0400 Subject: [PATCH] Refactor logic to replace ampersand --- lib/xml_builder.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/xml_builder.ex b/lib/xml_builder.ex index 61891d7..dbba2ea 100644 --- a/lib/xml_builder.ex +++ b/lib/xml_builder.ex @@ -118,7 +118,10 @@ defmodule XmlBuilder do string |> String.replace(">", ">") |> String.replace("<", "<") - |> fn(s) -> Regex.replace(~r/&(?!lt;|gt;|quot;)/, s, "&") end.() + |> replace_ampersand end + defp replace_ampersand(string) do + Regex.replace(~r/&(?!lt;|gt;|quot;)/, string, "&") + end end