class A
@@ololo = 1
end
A::ololo
A.new.ololo
NoMethodError: undefined method `ololo'
okey. I need an attr_reader
class B
@@ololo = 1
attr_reader :ololo
end
A::ololo
NoMethodError: undefined method `ololo'
A.new.ololo
=> nil
wtf? is there any limit for ruby accessors?
class C
@@ololo = 1
def self.ololo
@@ololo
end
def ololo
@@ololo
end
end
C::ololo
=> 1
C.new.ololo
=> 1
Ruby men usually say "yeah! pretty good!". is this pretty good? Can anyone provide shorter code?