Fix warning: instance variable @head not initialized
and remove unused instance variable
This commit is contained in:
parent
e64af7d5ad
commit
144b11e03e
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user