My class declares attr_accessor :speed. In a method I wrote speed = 0 to reset it, but afterwards motor.speed still returns the old value. Reading speed in the same method works fine, and @speed = 0 works too. In another class I mistyped @sped and got nil instead of an error.
What does attr_accessor actually generate, and what are the rules for using the attribute from inside the class?




