Class variable on singleton class

[email protected]$G$9!%e(B

e$B!!e(Bsingleton class e$B$KDj5A$7$?e(B class variable
e$B$O!$$I$&$"$D$+$C$?$b$N$Ge(B
e$B$7$g$&$+!%e(B

class C
obj = Object.new
@@vs = :Cvs
class << obj
@@vs = :objvs # (A)
end
class << obj
p @@vs
end
p @@vs
end

e$B!!$3$N$h$&$J%W%m%0%i%`[email protected]$H!$e(B(A) e$B$K$*$$$F!$e(B1.8
e$B$G$OFC0[%/%i%9$r%9%-%Ce(B
e$B%W$7$F!$e(BCe$B$Ne([email protected]@vs e$B$KCM$r=q$-9~$_$^$9!%e(B

e$B!!e(B1.9
e$B$G$O!$FC0[%/%i%9$r%9%-%C%W$7$F$$$J$$$N$GFC0[%/%i%9$KB8:_$9$k%/e(B
e$B%i%9JQ?t$r:n$C$F$7$^$$$^$9!%$3$l$O!$e(B1.8
e$B$K$"$o$;$k$N$,NI$$$G$7$g$&$+!%e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs