خرید بک لینک

Vote count: 0

Preface: I do understand the standard definition for attr_accessor and know that attr_accessor stands for two instance methods-a setter and a writer, and attr_accessor allows instances variables to be accessible throughout the class.

But now and then I see an element included in attr_accessor AND is defined as a method.

So my question is: Why does that happen? Is it just bad code I saw?

Pseudo/example code:

class Such_n_such
    attr_accessor :name, :color  
            #code omitted
       def color=(color)
         (some code)
       end

Thanks in advance!

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 29 اسفند 1394 ساعت: 21:54

صفحه بندی