def self.convert_all_arguments_to_path(klass, selector, skip)
mod = class << klass; self; end
unless mod.method_defined? selector
warn "#{mod}##{selector} is not defined, so arguments can't converted to path"
return
end
first_args = (1..skip).map{|i| "arg_#{i}"}.join(",") + (skip > 0 ? "," : "")
alias_method_chain(mod, selector, :potential_path_arguments) do |aliased_target, punctuation|
mod.module_eval "def \#{aliased_target}_with_potential_path_arguments\#{punctuation}(\#{first_args}*files, &block)\nfiles = files.map{|f| Backports.convert_path(f) }\n\#{aliased_target}_without_potential_path_arguments\#{punctuation}(\#{first_args}*files, &block)\nend\n", __FILE__, __LINE__ + 1
end
end