For this code, why did we need attr_accessor? Isn't the only time we use radians when we call it at the end? I thought that is why we had the initialize method. I'm not really sure what all the attr type functions do or why they are necessary. Can anyone explain?

class Angle

include Math

attr_accessor :radians

def initialize(radians)

@radians = radians

end

def cosine

cos(@radians)

end

end

acute = Angle.new(1)

acute.cosine