From 13e00ce6064fd1ce143071e3531e65f64047b013 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 9 Apr 2010 15:56:50 -0300 Subject: fix stack trace lines on class_eval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activeresource/lib/active_resource/base.rb | 4 ++-- activeresource/lib/active_resource/http_mock.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'activeresource') diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index 1e81fc099c..1dd5af8098 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -588,11 +588,11 @@ module ActiveResource @prefix_parameters = nil # Redefine the new methods. - code = <<-end_code + code, line = <<-end_code, __LINE__ + 1 def prefix_source() "#{value}" end def prefix(options={}) "#{prefix_call}" end end_code - silence_warnings { instance_eval code, __FILE__, __LINE__ } + silence_warnings { instance_eval code, __FILE__, line } rescue logger.error "Couldn't set prefix: #{$!}\n #{code}" if logger raise diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb index e5891300a6..1ed3804017 100644 --- a/activeresource/lib/active_resource/http_mock.rb +++ b/activeresource/lib/active_resource/http_mock.rb @@ -57,7 +57,7 @@ module ActiveResource # def post(path, request_headers = {}, body = nil, status = 200, response_headers = {}) # @responses[Request.new(:post, path, nil, request_headers)] = Response.new(body || "", status, response_headers) # end - module_eval <<-EOE, __FILE__, __LINE__ + module_eval <<-EOE, __FILE__, __LINE__ + 1 def #{method}(path, request_headers = {}, body = nil, status = 200, response_headers = {}) @responses << [Request.new(:#{method}, path, nil, request_headers), Response.new(body || "", status, response_headers)] end @@ -125,7 +125,7 @@ module ActiveResource # self.class.requests << request # self.class.responses.assoc(request).try(:second) || raise(InvalidRequestError.new("No response recorded for #{request}")) # end - module_eval <<-EOE, __FILE__, __LINE__ + module_eval <<-EOE, __FILE__, __LINE__ + 1 def #{method}(path, #{'body, ' if has_body}headers) request = ActiveResource::Request.new(:#{method}, path, #{has_body ? 'body, ' : 'nil, '}headers) self.class.requests << request -- cgit v1.2.3