aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/pathname/clean_within.rb
blob: ae03e1bc5a94dafefc9cfc9ce79d106f3f80f0e9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                    
module ActiveSupport #:nodoc:
  module CoreExtensions #:nodoc:
    module Pathname #:nodoc:
      module CleanWithin
        # Clean the paths contained in the provided string.
        def clean_within(string)
          string.gsub(%r{[\w. ]+(/[\w. ]+)+(\.rb)?(\b|$)}) do |path|
            new(path).cleanpath
          end
        end
      end
    end
  end
end