module Cheffish::WithPattern
Public Instance Methods
with(symbol)
click to toggle source
# File lib/cheffish/with_pattern.rb, line 3 def with(symbol) class_eval <<EOM attr_accessor :current_#{symbol} def with_#{symbol}(value) old_value = self.current_#{symbol} self.current_#{symbol} = value if block_given? begin yield ensure self.current_#{symbol} = old_value end end end EOM end