Sha256: 4859b78b5711e5884538eacf3c5355b9429de24e137c49f5ce5b926806e86023

Contents?: true

Size: 343 Bytes

Versions: 9

Compression:

Stored size: 343 Bytes

Contents

module MiscHelpers
  # copy'n'paste from plataformatec/show_for
  def swap(object, new_values)
    old_values = {}
    new_values.each do |key, value|
      old_values[key] = object.send key
      object.send :"#{key}=", value
    end
    yield
  ensure
    old_values.each do |key, value|
      object.send :"#{key}=", value
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
link_to_action-0.3.0 test/support/misc_helpers.rb
link_to_action-0.2.5 test/support/misc_helpers.rb
link_to_action-0.2.4 test/support/misc_helpers.rb
link_to_action-0.2.3 test/support/misc_helpers.rb
link_to_action-0.2.2 test/support/misc_helpers.rb
link_to_action-0.2.1 test/support/misc_helpers.rb
link_to_action-0.2.0 test/support/misc_helpers.rb
link_to_action-0.1.3 test/support/misc_helpers.rb
link_to_action-0.1.2 test/support/misc_helpers.rb