Skip to content

Latest commit

 

History

History
11 lines (7 loc) · 428 Bytes

finding-getters.md

File metadata and controls

11 lines (7 loc) · 428 Bytes

Finding Getters

After writing the other day about why you might not want to use simple getters, I decided that I wanted to eliminate all such methods from a project.

Here is the regex I wrote to isolate the pattern:

ag 'def (\w+);?\s+@\1;?\s+end'

The semicolon catches one-line getter methods as well as the more common three-line.