Class: Antlers::HTMLNode

Inherits:
LeafNode show all
Defined in:
lib/nodes/html_node.rb

Constant Summary

Constants inherited from AntlerNode

AntlerNode::DEF_KEY, AntlerNode::END_KEY

Instance Attribute Summary

Attributes inherited from AntlerNode

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AntlerNode

#==, #end_name, #eql?, #hash

Constructor Details

#initialize(html:) ⇒ HTMLNode

Returns a new instance of HTMLNode.



7
8
9
10
11
# File 'lib/nodes/html_node.rb', line 7

def initialize(html:)
  super(name: nil)

  @html = html
end

Class Method Details

.build(segment:) ⇒ Object



22
23
24
# File 'lib/nodes/html_node.rb', line 22

def build(segment:, **)
  new(html: segment)
end

.match?(segment:) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/nodes/html_node.rb', line 18

def match?(segment:)
  segment.is_a?(String)
end

Instance Method Details

#renderObject



13
14
15
# File 'lib/nodes/html_node.rb', line 13

def render(**)
  @html
end