diff options
| author | Clinton R. Nixon | 2009-09-22 13:03:46 -0400 |
|---|---|---|
| committer | Max Howell | 2009-09-24 18:26:16 +0100 |
| commit | 2668e2aeffb6c77cf29cec01b5c02a3077133227 (patch) | |
| tree | 452b653cd98c54eb6639ee8c7c3185f3b12752af /Library/Homebrew/utils.rb | |
| parent | 44a3d59630fddaa45767174c35ed410984eeb60b (diff) | |
| download | brew-2668e2aeffb6c77cf29cec01b5c02a3077133227.tar.bz2 | |
DRYed up "@foo=self.class.foo unless @foo" statements
Using the example from the existing code:
CHECKSUM_TYPES.each do |type|
if !instance_variable_defined?("@#{type}")
class_value = self.class.send(type)
instance_variable_set("@#{type}", class_value) if class_value
end
end
I extracted that block into a method 'set_instance_variable' which I
then used in all places where this behavior was being used.
Diffstat (limited to 'Library/Homebrew/utils.rb')
0 files changed, 0 insertions, 0 deletions
