I'm a Ruby newbie. Have a very basic 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 code above allow initialization of a member variable: @member, inside the static method: Test::init ? My understanding was that usage of @member will throw an error because it is not tied to any instance of class Test. But no error is thrown.