Class: Arbre::HTML::TextNode
- Defined in:
- lib/active_admin/arbre/html/text_node.rb
Instance Attribute Summary
Attributes inherited from Element
Class Method Summary collapse
-
.from_string(string) ⇒ Object
Builds a text node from a string.
Instance Method Summary collapse
Methods inherited from Element
#+, #<<, #assigns, builder_method, #content, #content=, #document, #each, #get_elements_by_class_name, #get_elements_by_tag_name, #helpers, #html_safe, #indent_level, #initialize, #parent?, #remove_child, #to_ary, #to_str
Methods included from Builder::BuilderMethods
#append_return_block, #build_tag, #current_dom_context, #insert_tag, #with_current_dom_context
Methods included from Builder
#current_dom_context, #helpers, #method_missing
Constructor Details
This class inherits a constructor from Arbre::HTML::Element
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Arbre::Builder
Class Method Details
.from_string(string) ⇒ Object
Builds a text node from a string
11 12 13 14 15 |
# File 'lib/active_admin/arbre/html/text_node.rb', line 11 def self.from_string(string) node = new node.build(string) node end |
Instance Method Details
#add_child(*args) ⇒ Object
17 18 19 |
# File 'lib/active_admin/arbre/html/text_node.rb', line 17 def add_child(*args) raise "TextNodes do not have children" end |
#build(string) ⇒ Object
21 22 23 |
# File 'lib/active_admin/arbre/html/text_node.rb', line 21 def build(string) @content = string end |
#tag_name ⇒ Object
25 26 27 |
# File 'lib/active_admin/arbre/html/text_node.rb', line 25 def tag_name nil end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/active_admin/arbre/html/text_node.rb', line 29 def to_s ERB::Util.html_escape(@content.to_s) end |