From aee77fcc717d29c20bc3b1eff367e77df8f19c17 Mon Sep 17 00:00:00 2001 From: stephann Date: Mon, 5 Jan 2026 16:47:47 -0300 Subject: [PATCH] Refactor #render_attributes --- src/blueprint/html.cr | 6 +++--- src/blueprint/html/element_registrar.cr | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/blueprint/html.cr b/src/blueprint/html.cr index 2468bed..2cc52c3 100644 --- a/src/blueprint/html.cr +++ b/src/blueprint/html.cr @@ -78,7 +78,7 @@ module Blueprint::HTML def element(tag_name : String | Symbol, **attributes, &) : Nil buffer << "<" buffer << tag_name - render_attributes(attributes, to: buffer) + render_attributes(attributes) buffer << ">" BufferRenderer.render(to: buffer) { yield } buffer << "" end @@ -135,7 +135,7 @@ module Blueprint::HTML safe EscapeOnce.escape(value) end - private def render_attributes(attributes : Hash | NamedTuple, to buffer : String::Builder) : Nil + private def render_attributes(attributes : Hash | NamedTuple) : Nil AttributesRenderer.render(attributes, to: buffer) end end diff --git a/src/blueprint/html/element_registrar.cr b/src/blueprint/html/element_registrar.cr index 32bd7e2..765a988 100644 --- a/src/blueprint/html/element_registrar.cr +++ b/src/blueprint/html/element_registrar.cr @@ -12,7 +12,7 @@ module Blueprint::HTML::ElementRegistrar def {{method_name.id}}(attributes : NamedTuple | Hash, &block) : Nil buffer << "<{{tag.id}}" - render_attributes(attributes, to: buffer) + render_attributes(attributes) buffer << ">" BufferRenderer.render(to: buffer) { yield } buffer << "" @@ -20,7 +20,7 @@ module Blueprint::HTML::ElementRegistrar def {{method_name.id}}(attributes : NamedTuple | Hash) : Nil buffer << "<{{tag.id}}" - render_attributes(attributes, to: buffer) + render_attributes(attributes) buffer << ">" end end @@ -34,7 +34,7 @@ module Blueprint::HTML::ElementRegistrar def {{method_name.id}}(attributes : NamedTuple | Hash) : Nil buffer << "<{{tag.id}}" - render_attributes(attributes, to: buffer) + render_attributes(attributes) buffer << ">" end end @@ -48,7 +48,7 @@ module Blueprint::HTML::ElementRegistrar def {{method_name.id}}(attributes : NamedTuple | Hash) : Nil buffer << "<{{tag.id}}" - render_attributes(attributes, to: buffer) + render_attributes(attributes) buffer << ">" end end