Skip to content
Snippets Groups Projects
Commit 2668e2ae authored by Clinton R. Nixon's avatar Clinton R. Nixon Committed by Max Howell
Browse files

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.
parent 44a3d596
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment