Class: Campa::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/campa/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, next_node: nil) ⇒ Node

Returns a new instance of Node.



6
7
8
9
# File 'lib/campa/node.rb', line 6

def initialize(value:, next_node: nil)
  @value = value
  @next_node = next_node
end

Instance Attribute Details

#next_nodeObject

Returns the value of attribute next_node.



3
4
5
# File 'lib/campa/node.rb', line 3

def next_node
  @next_node
end

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/campa/node.rb', line 4

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
15
# File 'lib/campa/node.rb', line 11

def ==(other)
  return false if !other.is_a?(Node)

  value == other.value
end