Sha256: 96819b67ddcfed809f7d89e944d4924a24670782e5f9cb9233ec7810688c797a
Contents?: true
Size: 663 Bytes
Versions: 3
Compression:
Stored size: 663 Bytes
Contents
require 'erb' module Arbo 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 def render_in(context) to_s.tap { |s| context.output_buffer << s } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
arbo-1.3.1 | lib/arbo/html/text_node.rb |
arbo-1.3.0 | lib/arbo/html/text_node.rb |
arbo-1.2.0 | lib/arbo/html/text_node.rb |