Method: VestalVersions::Control::ClassMethods#_with_version_flag
- Defined in:
- lib/vestal_versions/control.rb
#_with_version_flag(flag) ⇒ Object
Used for each control block, the with_version_flag method sets a given variable to true and then executes the given block, ensuring that the variable is returned to a nil value before returning. This is useful to be certain that one of the control flag instance variables isn’t inadvertently left in the “on” position by execution within the block raising an exception.
190 191 192 193 194 195 |
# File 'lib/vestal_versions/control.rb', line 190 def _with_version_flag(flag) self.send("#{flag}=", true) yield ensure self.send("#{flag}=", nil) end |