Class: Hanami::Helpers::HtmlHelper::HtmlNode Private
- Inherits:
-
EmptyHtmlNode
- Object
- EmptyHtmlNode
- Hanami::Helpers::HtmlHelper::HtmlNode
- Defined in:
- lib/hanami/helpers/html_helper/html_node.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
HTML node
Direct Known Subclasses
Constant Summary
Constants inherited from EmptyHtmlNode
EmptyHtmlNode::ATTRIBUTES_SEPARATOR, EmptyHtmlNode::BOOLEAN_ATTRIBUTES
Instance Method Summary collapse
-
#initialize(name, content, attributes, _options = {}) ⇒ Hanami::Helpers::HtmlHelper::HtmlNode
constructor
private
Initialize a new HTML node.
-
#to_s ⇒ String
private
Resolve and return the output.
Constructor Details
#initialize(name, content, attributes, _options = {}) ⇒ Hanami::Helpers::HtmlHelper::HtmlNode
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a new HTML node
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hanami/helpers/html_helper/html_node.rb', line 22 def initialize(name, content, attributes, = {}) @builder = HtmlBuilder.new @name = name @content = if content.is_a?(Hash) @attributes = content nil else attributes_hash = attributes.to_h if attributes.respond_to?(:to_h) @attributes = prepare_html_attributes(attributes_hash) content end end |
Instance Method Details
#to_s ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resolve and return the output
43 44 45 |
# File 'lib/hanami/helpers/html_helper/html_node.rb', line 43 def to_s %(#{super}#{content}</#{@name}>) end |