Module: ActiveSupport::CoreExtensions::Pathname::CleanWithin

Included in:
Pathname
Defined in:
lib/active_support/core_ext/pathname/clean_within.rb

Instance Method Summary collapse

Instance Method Details

#clean_within(string) ⇒ Object

Clean the paths contained in the provided string.


6
7
8
9
10
# File 'lib/active_support/core_ext/pathname/clean_within.rb', line 6

def clean_within(string)
  string.gsub(%r{[\w. ]+(/[\w. ]+)+(\.rb)?(\b|$)}) do |path|
    new(path).cleanpath
  end
end