Ruby really is a great language. The author just posted a poor example that is frankly NOT idiomatic Ruby. The proper way to create a getter and setter method on an instance variable is like so:
class Person
attr_accessor :sanity
def initialize
@sanity = 50
end
end