Module: LintFu::Mixins::FileClassMethods

Included in:
File
Defined in:
lib/lint_fu/mixins/file_class_methods.rb

Instance Method Summary collapse

Instance Method Details

#relative_path(base, path) ⇒ Object

Raises:

  • (Errno::ENOENT)


4
5
6
7
8
9
# File 'lib/lint_fu/mixins/file_class_methods.rb', line 4

def relative_path(base, path)
  base = File.expand_path(base)
  path = File.expand_path(path)
  raise Errno::ENOENT unless path.index(base) == 0
  return path[base.length+1..-1]
end