class Test
class << self
attr_accessor :some
def set_some
puts self.inspect
some = \'some_data\'
end
def get_some
puts sel
in the first method
def set_some
puts self.inspect
some = 'some_data'
end
some is a local variable.. its not the same as @some that is a instance variable (in this case a class instance variable) so the value disappears when the method ends.
if you want to call the setter method some or set @some to something then do this
@some = 'some_data'
or
self.some = 'some_data'
in the second method
def get_some
puts self.inspect
self.some
end
your calling the method some. which returns the instace variable @some.. and since at this point @some has no value.. returns nil..