class RubyCollections::LinkedList::Node
Attributes
data[RW]
Public Class Methods
new(data, next_node)
click to toggle source
# File lib/ruby_collections/linked_list.rb, line 56 def initialize(data, next_node) @data = data @next = next_node.object_id end
Public Instance Methods
getNext()
click to toggle source
# File lib/ruby_collections/linked_list.rb, line 61 def getNext ObjectSpace._id2ref(@next) end
setNext(data)
click to toggle source
# File lib/ruby_collections/linked_list.rb, line 65 def setNext(data) node = Node.new(data, nil) next_node_id = instance_variable_get(:@next) @next = node.object_id node.instance_variable_set(:@next, next_node_id) return node end
to_s()
click to toggle source
# File lib/ruby_collections/linked_list.rb, line 73 def to_s "#{data}" end