def _getRubyFlagsFromPath(self, pathName, rubyVersion):
        pathList = pathName.split('/')
        pathList = [ x for x in pathList if x ]
        foundLib = False
        foundVer = False
        flags = set()
        for dirName in pathList:
            if not foundLib and dirName.startswith('lib'):
                foundLib = True
                flags.add(dirName)
            elif not foundVer and dirName.split('.')[:1] == rubyVersion.split('.')[:1]:
                # we only compare major and minor versions due to
                # ruby api version (dirName) differing from programs
                # version (rubyVersion)
                foundVer = True
                flags.add(dirName)
            if foundLib and foundVer:
                break
        return flags