Class: HerbCombinedNode
- Inherits:
-
Object
- Object
- HerbCombinedNode
- Defined in:
- lib/nodes/herb_combined_node.rb
Instance Method Summary collapse
- #can_be_combined? ⇒ Boolean
- #html? ⇒ Boolean
-
#initialize(node_a, node_b) ⇒ HerbCombinedNode
constructor
A new instance of HerbCombinedNode.
- #node_name ⇒ Object
- #should_be_unrolled? ⇒ Boolean
- #text? ⇒ Boolean
- #text_value ⇒ Object
- #to_s ⇒ Object
- #unroll ⇒ Object
- #whitespace? ⇒ Boolean
Constructor Details
#initialize(node_a, node_b) ⇒ HerbCombinedNode
Returns a new instance of HerbCombinedNode.
3 4 5 |
# File 'lib/nodes/herb_combined_node.rb', line 3 def initialize( node_a, node_b ) @combined_nodes = [node_a, node_b] end |
Instance Method Details
#can_be_combined? ⇒ Boolean
11 12 13 |
# File 'lib/nodes/herb_combined_node.rb', line 11 def can_be_combined? true end |
#html? ⇒ Boolean
19 20 21 |
# File 'lib/nodes/herb_combined_node.rb', line 19 def html? true end |
#node_name ⇒ Object
7 8 9 |
# File 'lib/nodes/herb_combined_node.rb', line 7 def node_name "herb_combined_nodes" end |
#should_be_unrolled? ⇒ Boolean
15 16 17 |
# File 'lib/nodes/herb_combined_node.rb', line 15 def should_be_unrolled? @combined_nodes.last.white_space? end |
#text? ⇒ Boolean
23 24 25 |
# File 'lib/nodes/herb_combined_node.rb', line 23 def text? @combined_nodes.first.text? || @combined_nodes.last.text? end |
#text_value ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/nodes/herb_combined_node.rb', line 27 def text_value to_return = ""; @combined_nodes.each do |node| to_return << node.text_value end to_return end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/nodes/herb_combined_node.rb', line 35 def to_s self.text_value end |
#unroll ⇒ Object
43 44 45 |
# File 'lib/nodes/herb_combined_node.rb', line 43 def unroll @combined_nodes end |
#whitespace? ⇒ Boolean
39 40 41 |
# File 'lib/nodes/herb_combined_node.rb', line 39 def whitespace? @combined_nodes.first.whitespace? || @combined_nodes.last.whitespace? end |