Class: Antlers::AntlerNode

Inherits:
Object
  • Object
show all
Defined in:
lib/interfaces/antler_node.rb

Direct Known Subclasses

BranchNode, LeafNode

Constant Summary collapse

DEF_KEY =
nil
END_KEY =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:) ⇒ AntlerNode

Returns a new instance of AntlerNode.



10
11
12
# File 'lib/interfaces/antler_node.rb', line 10

def initialize(name:)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/interfaces/antler_node.rb', line 5

def name
  @name
end

Class Method Details

.build(segment:, namespace:) ⇒ Object

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/interfaces/antler_node.rb', line 27

def build(segment:, namespace:)
  raise NotImplementedError
end

.match?(segment:) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/interfaces/antler_node.rb', line 23

def match?(segment:)
  raise NotImplementedError
end

Instance Method Details

#==(other) ⇒ Object

Compare instance as a value object.



33
# File 'lib/interfaces/antler_node.rb', line 33

def ==(other) = other.class == self.class

#end_nameObject



18
19
20
# File 'lib/interfaces/antler_node.rb', line 18

def end_name
  'level_1'
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


34
# File 'lib/interfaces/antler_node.rb', line 34

def eql?(other) = self == other

#hashObject



35
# File 'lib/interfaces/antler_node.rb', line 35

def hash = [self.class].hash

#render(current_binding: nil, parent_binding: nil, slot_node: nil, namespace: nil) ⇒ Object

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/interfaces/antler_node.rb', line 14

def render(current_binding: nil, parent_binding: nil, slot_node: nil, namespace: nil)
  raise NotImplementedError
end