Sha256: cad82581129ac6976199d313f5ad950f11ae9784b3881f32cc397210c2a78eed

Contents?: true

Size: 572 Bytes

Versions: 10

Compression:

Stored size: 572 Bytes

Contents

require 'erb'

module Arbre
  module HTML

    class TextNode < Element

      builder_method :text_node

      # Builds a text node from a string
      def self.from_string(string)
        node = new
        node.build(string)
        node
      end

      def add_child(*args)
        raise "TextNodes do not have children"
      end

      def build(string)
        @content = string
      end

      def class_list
        []
      end

      def tag_name
        nil
      end

      def to_s
        ERB::Util.html_escape(@content.to_s)
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/arbre-1.4.0/lib/arbre/html/text_node.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/arbre-1.4.0/lib/arbre/html/text_node.rb
arbre-1.4.0 lib/arbre/html/text_node.rb
arbre-1.3.0 lib/arbre/html/text_node.rb
arbre-1.2.1 lib/arbre/html/text_node.rb
arbre-1.2.0 lib/arbre/html/text_node.rb
arbre-1.2.0.rc1 lib/arbre/html/text_node.rb
arbre-1.1.1 lib/arbre/html/text_node.rb
arbre-1.0.3 lib/arbre/html/text_node.rb
arbre-1.0.2 lib/arbre/html/text_node.rb