diff options
| author | Clinton R. Nixon | 2009-09-22 13:03:46 -0400 |
|---|---|---|
| committer | Max Howell | 2009-09-24 18:26:16 +0100 |
| commit | 3acaab7139ce64d2246f526557aa53bc1e635c4e (patch) | |
| tree | 371c871705e0851892548095105a912e77c606fe /Library/Formula | |
| parent | 9713b07890effbcfe08e89100a55f446abc6ab87 (diff) | |
| download | homebrew-3acaab7139ce64d2246f526557aa53bc1e635c4e.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/Formula')
0 files changed, 0 insertions, 0 deletions
