Remove useless parenthesis.

toying-with-ramdb
Philippe PITTOLI 2024-05-26 01:39:49 +02:00
parent c89c32eca0
commit b52ef159e4
1 changed files with 18 additions and 18 deletions

View File

@ -67,10 +67,10 @@ class DoubleLinkedList(V)
#
# ```
# list = DoubleLinkedList(Int32).new
# list.push(1)
# list.push(2)
# list.pop() # => 2
# list.pop() # => 1
# list.push 1
# list.push 2
# list.pop # => 2
# list.pop # => 1
# ```
def push(value : V) : Node(V)
# First entry is nil = pushing the first entry.
@ -145,9 +145,9 @@ class DoubleLinkedList(V)
# list = DoubleLinkedList(Int32).new
# list << 1
# list << 2 << 3
# list.pop() # => 3
# list.pop() # => 2
# list.pop() # => 1
# list.pop # => 3
# list.pop # => 2
# list.pop # => 1
# ```
def <<(value : V) : DoubleLinkedList(V)
push(value)
@ -159,8 +159,8 @@ class DoubleLinkedList(V)
# ```
# list = DoubleLinkedList(Int32).new
# list.push(1, 2)
# list.pop() # => 2
# list.pop() # => 1
# list.pop # => 2
# list.pop # => 1
# ```
def push(*values)
values.each do |value|
@ -174,8 +174,8 @@ class DoubleLinkedList(V)
# list = DoubleLinkedList(Int32).new
# list << 1
# list.unshift 2
# list.pop() # => 1
# list.pop() # => 2
# list.pop # => 1
# list.pop # => 2
# ```
def unshift(value : V) : Node(V)
if first = @first
@ -229,8 +229,8 @@ class DoubleLinkedList(V)
# list = DoubleLinkedList(Int32).new
# list << 1
# list << 2
# list.pop() # => 2
# list.peek() # => 1
# list.pop # => 2
# list.peek # => 1
# ```
def pop : Node(V)
if @size == 0
@ -341,7 +341,7 @@ class DoubleLinkedList(V)
# ```
# list = DoubleLinkedList(Int32).new
# list.empty? # => true
# list.push(1)
# list << 1
# list.empty? # => false
# ```
def empty?
@ -353,9 +353,9 @@ class DoubleLinkedList(V)
# ```
# list = DoubleLinkedList(Int32).new(1, 2, 3)
# reversed_list = list.reverse
# list.pop() # => 1
# list.pop() # => 2
# list.pop() # => 3
# list.pop # => 1
# list.pop # => 2
# list.pop # => 3
# ```
def reverse
DoubleLinkedList(V).new.tap do |new_list|
@ -371,7 +371,7 @@ class DoubleLinkedList(V)
# values = [1, 2, 3]
# list = DoubleLinkedList(Int32).new(values)
# list.each_node do |elem|
# puts elem.value
# puts elem.value
# end
# ```
private def each_node