class Campa::Node

A node containing a value to form a linked {List}.

Attributes

next_node[RW]
value[R]

Public Class Methods

new(value:, next_node: nil) click to toggle source

@param value [Object] actual value in the {List} node @param next_node [Node] next node linked in the {List} chain,

this {Node} is the last if <i>next_node:</i> is <i>nil</i>
# File lib/campa/node.rb, line 10
def initialize(value:, next_node: nil)
  @value = value
  @next_node = next_node
end

Public Instance Methods

==(other) click to toggle source

@param other [Node] to be compared @return [Boolean] true if {#value} is #== on both {Node}

# File lib/campa/node.rb, line 17
def ==(other)
  return false if !other.is_a?(Node)

  value == other.value
end