lib/hanami/helpers/html_helper/html_node.rb in hanami-helpers-1.1.2 vs lib/hanami/helpers/html_helper/html_node.rb in hanami-helpers-1.2.0.beta1
- old
+ new
@@ -20,15 +20,15 @@
#
# @return [Hanami::Helpers::HtmlHelper::HtmlNode]
def initialize(name, content, attributes, _options = {})
@builder = HtmlBuilder.new
@name = name
- @content = case content
- when Hash
+ @content = if content.is_a?(Hash)
@attributes = content
nil
else
- @attributes = attributes.to_h if attributes.respond_to?(:to_h)
+ attributes_hash = attributes.to_h if attributes.respond_to?(:to_h)
+ @attributes = prepare_html_attributes(attributes_hash)
content
end
end
# Resolve and return the output