From 55fab3bb52b68757aeaa382d91ed4a314299773e Mon Sep 17 00:00:00 2001 From: Myron Marston Date: Fri, 11 Feb 2011 12:40:03 -0800 Subject: [PATCH] Use a more straightforward way to delegate to Object#method. Technique taken from: http://avdi.org/devblog/2010/02/25/calling-grandparents-in-ruby/ --- lib/vcr/structs/request.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vcr/structs/request.rb b/lib/vcr/structs/request.rb index 0132085b..2a625f0a 100644 --- a/lib/vcr/structs/request.rb +++ b/lib/vcr/structs/request.rb @@ -3,7 +3,6 @@ class Request < Struct.new(:method, :uri, :body, :headers) include Normalizers::Header include Normalizers::URI include Normalizers::Body - include Module.new { alias __method__ method } def self.from_net_http_request(net_http, request) new( @@ -14,9 +13,10 @@ def self.from_net_http_request(net_http, request) ) end + @@object_method = Object.instance_method(:method) def method(*args) return super if args.empty? - __method__(*args) + @@object_method.bind(self).call(*args) end def matcher(match_attributes)