Sha256: eda9d7cd28650c125f708d87c9889ea4bd265d5df59987b714cc60ba38377845

Contents?: true

Size: 779 Bytes

Versions: 26

Compression:

Stored size: 779 Bytes

Contents

require 'hanami/utils/escape'

module Hanami
  module Helpers
    module HtmlHelper
      # Text node. Allows for text to be inserted between HTML tags.
      #
      # @since 0.2.5
      # @api private
      class TextNode
        # Initialize a new text node
        #
        # @param content [String,#to_s] The content to be added.
        #
        # @return [Hanami::Helpers::HtmlHelper::TextNode]
        #
        # @since 0.2.5
        # @api private
        def initialize(content)
          @content = content.to_s
        end

        # Resolve and return the output
        #
        # @return [String] the output
        #
        # @since 0.2.5
        # @api private
        def to_s
          Utils::Escape.html(@content)
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
hanami-helpers-1.3.3 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.3.2 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.3.1 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.3.0 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.3.0.beta1 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.2.2 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.2.1 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.2.0 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.2.0.rc2 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.1.2 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.2.0.rc1 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.2.0.beta2 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.2.0.beta1 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.1.1 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.1.0 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.1.0.rc1 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.1.0.beta3 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.1.0.beta2 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.1.0.beta1 lib/hanami/helpers/html_helper/text_node.rb
hanami-helpers-1.0.0 lib/hanami/helpers/html_helper/text_node.rb