ruby-changes:64319
From: Kazuhiro <ko1@a...>
Date: Sat, 19 Dec 2020 15:25:09 +0900 (JST)
Subject: [ruby-changes:64319] 144b11e03e (master): Fix `warning: instance variable @head not initialized` and remove unused instance variable
https://git.ruby-lang.org/ruby.git/commit/?id=144b11e03e From 144b11e03ee0994cacd3fa5eb9ff8b87bd627452 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA <zn@m...> Date: Sat, 19 Dec 2020 15:24:09 +0900 Subject: Fix `warning: instance variable @head not initialized` and remove unused instance variable diff --git a/sample/list.rb b/sample/list.rb index b4d1d65..7458ba0 100644 --- a/sample/list.rb +++ b/sample/list.rb @@ -5,7 +5,6 @@ class MyElem https://github.com/ruby/ruby/blob/trunk/sample/list.rb#L5 # @variables are instance variable, no declaration needed @data = item @succ = nil - @head = nil end def data @@ -23,6 +22,10 @@ class MyElem https://github.com/ruby/ruby/blob/trunk/sample/list.rb#L22 end class MyList + def initialize + @head = nil + end + def add_to_list(obj) elt = MyElem.new(obj) if @head -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/