Skip to content

Commit

Permalink
Eliminate Pathname extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Apr 18, 2009
1 parent 727e9dc commit bd84b82
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 30 deletions.
17 changes: 12 additions & 5 deletions activesupport/lib/active_support/core_ext/exception.rb
@@ -1,13 +1,19 @@
require 'active_support/core_ext/pathname'

module ActiveSupport
FrozenObjectError = RUBY_VERSION < '1.9' ? TypeError : RuntimeError
end

# TODO: Turn all this into using the BacktraceCleaner.
class Exception # :nodoc:
# Clean the paths contained in the message.
def self.clean_paths(string)
require 'pathname' unless defined? Pathname
string.gsub(%r{[\w. ]+(/[\w. ]+)+(\.rb)?(\b|$)}) do |path|
Pathname.new(path).cleanpath
end
end

def clean_message
Pathname.clean_within message
Exception.clean_paths(message)
end

TraceSubstitutions = []
Expand All @@ -16,9 +22,10 @@ def clean_message

def clean_backtrace
backtrace.collect do |line|
Pathname.clean_within(TraceSubstitutions.inject(line) do |result, (regexp, sub)|
substituted = TraceSubstitutions.inject(line) do |result, (regexp, sub)|
result.gsub regexp, sub
end)
end
Exception.clean_paths(substituted)
end
end

Expand Down
5 changes: 0 additions & 5 deletions activesupport/lib/active_support/core_ext/pathname.rb

This file was deleted.

10 changes: 0 additions & 10 deletions activesupport/lib/active_support/core_ext/pathname/clean_within.rb

This file was deleted.

10 changes: 0 additions & 10 deletions activesupport/test/core_ext/pathname_test.rb

This file was deleted.

0 comments on commit bd84b82

Please sign in to comment.