bbatsov/ruby-style-guide — pull request #310 by kia84 (2014-04-07 07:04:51+00:00)
Title: Classes: use attributes directly instead of call accessors methods.

Hello!

I added a few rules for use of `attr`-family methods inside a class definition.

In example `name` is equivalent of `self.name` and this is a complete method call.

`@name` is more readable, and faster in use.

You can simple test it something like this:

```ruby
class TestClass
attr_reader :name

def initialize
@name = 'test_name'
end

def test1
t = Time.now
100_000_000.times{ @name }
Time.now - t
end

def test2
t = Time.now
100_000_000.times{ name }
Time.now - t
end
end

x = TestClass.new
puts x.test1
puts x.test2
```

Moreover you can never shade `@name` of a some local variable. :smirk: