t.number = 13
is just a shorthand for t.number=(13)
, they are effectively the same statement in Ruby.
attr_accessor :b
creates the equivalent of the following two methods:
def b
@b
end
def b=(new_val)
@b = new_val
end
So in your code example, you could replace the two methods #number
and #number=
with attr_accessor :number