Changeset 5535
- Timestamp:
- 11/16/06 06:40:05 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/lib/active_support/deprecation.rb
r5356 r5535 52 52 private 53 53 def deprecation_message(callstack, message = nil) 54 message ||= "You are using deprecated behavior which will be removed from Rails 2.0." 55 "DEPRECATION WARNING: #{message} See http://www.rubyonrails.org/deprecation for details. #{deprecation_caller_message(callstack)}" 56 end 57 58 def deprecation_caller_message(callstack) 54 59 file, line, method = extract_callstack(callstack) 55 message ||= "You are using deprecated behavior which will be removed from Rails 2.0." 56 "DEPRECATION WARNING: #{message} See http://www.rubyonrails.org/deprecation for details. (called from #{method} at #{file}:#{line})" 60 if file 61 if line && method 62 "(called from #{method} at #{file}:#{line})" 63 else 64 "(called from #{file}:#{line})" 65 end 66 end 57 67 end 58 68 59 69 def extract_callstack(callstack) 60 callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures 70 if md = callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/) 71 md.captures 72 else 73 callstack.first 74 end 61 75 end 62 76 end