Class: Hanami::Helpers::HtmlHelper::TextNode Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/helpers/html_helper/text_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.

Text node. Allows for text to be inserted between HTML tags.

Since:

  • 0.2.5

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Hanami::Helpers::HtmlHelper::TextNode

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 text node

Parameters:

  • content (String, #to_s)

    The content to be added.

Since:

  • 0.2.5



19
20
21
# File 'lib/hanami/helpers/html_helper/text_node.rb', line 19

def initialize(content)
  @content = content.to_s
end

Instance Method Details

#to_sString

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

Returns:

  • (String)

    the output

Since:

  • 0.2.5



29
30
31
# File 'lib/hanami/helpers/html_helper/text_node.rb', line 29

def to_s
  Utils::Escape.html(@content)
end