class Autotest::Rails

Constants

VERSION

Public Instance Methods

path_to_classname(s) click to toggle source

Convert the pathname s to the name of class.

# File lib/autotest/rails.rb, line 60
def path_to_classname(s)
  sep = File::SEPARATOR
  f = s.sub(/^test#{sep}((\w+)#{sep})?/, '').sub(/\.rb$/, '').split(sep)
  f = f.map { |path| path.split(/_/).map { |seg| seg.capitalize }.join }
  f = f.map { |path| path =~ /Test$/ ? path : "#{path}Test"  }
  f.join('::')
end