1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix warning: instance variable @head not initialized and remove unused instance variable

This commit is contained in:
Kazuhiro NISHIYAMA 2020-12-19 15:24:09 +09:00
parent e64af7d5ad
commit 144b11e03e
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A

View file

@ -5,7 +5,6 @@ class MyElem
# @variables are instance variable, no declaration needed # @variables are instance variable, no declaration needed
@data = item @data = item
@succ = nil @succ = nil
@head = nil
end end
def data def data
@ -23,6 +22,10 @@ class MyElem
end end
class MyList class MyList
def initialize
@head = nil
end
def add_to_list(obj) def add_to_list(obj)
elt = MyElem.new(obj) elt = MyElem.new(obj)
if @head if @head