On Tue, Feb 4, 2014 at 11:34 AM, Joel Pearson <lists / ruby-forum.com> wrote:
> tamouse m. wrote in post #1135295:
>>   def each
>>     return enum_for(:each) unless block_given?
>>
>>     loop do
>>       yield self.value
>>
>>       if self.value.odd?
>>         self.value = self.value * 3
>>       else
>>         self.value = self.value / 2
>>       end
>>
>>     end
>>
>>   end
>>
>> end
>
> I could be wrong, but aren't there 4 superfluous "self." in that code?
> As far as I know, you'd only need to use self when you're specifying the
> attr_writer rather than a local variable.
>
> --
> Posted via http://www.ruby-forum.com/.

Yes.

I use them to keep myself clear. They are entirely superfluous for the code.