diff options
Diffstat (limited to 'activeresource/test/setter_trap.rb')
-rw-r--r-- | activeresource/test/setter_trap.rb | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/activeresource/test/setter_trap.rb b/activeresource/test/setter_trap.rb deleted file mode 100644 index 7cfd9ca111..0000000000 --- a/activeresource/test/setter_trap.rb +++ /dev/null @@ -1,26 +0,0 @@ -class SetterTrap < ActiveSupport::BasicObject - class << self - def rollback_sets(obj) - trapped = new(obj) - yield(trapped).tap { trapped.rollback_sets } - end - end - - def initialize(obj) - @cache = {} - @obj = obj - end - - def respond_to?(method) - @obj.respond_to?(method) - end - - def method_missing(method, *args, &proc) - @cache[method] ||= @obj.send($`) if method.to_s =~ /=$/ - @obj.send method, *args, &proc - end - - def rollback_sets - @cache.each { |k, v| @obj.send k, v } - end -end |