Module: Police::VmInfo::Paths

Defined in:
lib/police/vminfo/paths.rb

Overview

Implementation details.

Class Method Summary collapse

Class Method Details

.descendant?(descendant, dir) ⇒ Boolean

True if a path points to a descendant of the directory in anothe

Returns:

  • (Boolean)


55
56
57
58
59
60
61
62
# File 'lib/police/vminfo/paths.rb', line 55

def descendant?(descendant, dir)
  if descendant.length > dir.length
    descendant[0, dir.length] == dir &&
        descendant[dir.length] == File::SEPARATOR
  else
    descendant == dir
  end
end