Class: Sablon::HTMLConverter::Collection
- Defined in:
- lib/sablon/html/ast.rb
Overview
A container for an array of AST nodes with convenience methods to work with the internal array as if it were a regular node
Constant Summary
Constants inherited from Node
Instance Attribute Summary collapse
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
- #<<(node) ⇒ Object
- #accept(visitor) ⇒ Object
-
#initialize(nodes) ⇒ Collection
constructor
A new instance of Collection.
- #inspect ⇒ Object
- #to_docx ⇒ Object
Methods inherited from Node
convert_style_property, node_name, process_properties, style_conversion
Constructor Details
#initialize(nodes) ⇒ Collection
Returns a new instance of Collection.
102 103 104 105 106 |
# File 'lib/sablon/html/ast.rb', line 102 def initialize(nodes) @properties ||= nil @attributes ||= {} @nodes = nodes end |
Instance Attribute Details
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
101 102 103 |
# File 'lib/sablon/html/ast.rb', line 101 def nodes @nodes end |
Instance Method Details
#<<(node) ⇒ Object
123 124 125 |
# File 'lib/sablon/html/ast.rb', line 123 def <<(node) @nodes << node end |
#accept(visitor) ⇒ Object
108 109 110 111 112 113 |
# File 'lib/sablon/html/ast.rb', line 108 def accept(visitor) super @nodes.each do |node| node.accept(visitor) end end |
#inspect ⇒ Object
119 120 121 |
# File 'lib/sablon/html/ast.rb', line 119 def inspect "[#{nodes.map(&:inspect).join(', ')}]" end |
#to_docx ⇒ Object
115 116 117 |
# File 'lib/sablon/html/ast.rb', line 115 def to_docx nodes.map(&:to_docx).join end |