I have the code in Ruby below:
class A
@@lock = Monitor.new
class B
def method
@@lock.synchronize
puts "xxxxx"
end
end
end
end
after starting it gives an error saying that below:
uninitialized class variable @@ lock in A :: B (NameError)
if I want to know how to access the external class Class variable @@ lock from the internal method of class B, how to do it? thanks in advance.
source
share