I am new to Ruby. You have a very simple question about static and instance variables.
class Test def self.init @@var_static = 1 @member = 2 end def self.print puts "@@var_static: #{@@var_static}" puts "@member: #{@member}" end end Test.init Test.print
Why does the above code initialize the member variable: @member, inside the static method: Test :: init? My understanding was that using @member will throw an error because it is not bound to any instance of the Test class. But the error does not occur.
source share