def _addRubyRequirements(self, path, fullpath, pkgFiles, script=False):
        macros = self.recipe.macros
        destdir = macros.destdir
        destDirLen = len(destdir)

        if self.rubyInterpreter is None:
            self.rubyInterpreter, bootstrap = self._getRuby(macros, path)
            if not self.rubyInterpreter:
                return
            self.rubyInvocation, self.rubyLoadPath = self._getRubyLoadPath(
                macros, self.rubyInterpreter, bootstrap)
            self.rubyVersion = self._getRubyVersion(macros)
        elif self.rubyInterpreter is False:
            return

        if not script:
            if not util.isregular(fullpath) or os.path.islink(fullpath):
                return
            foundInLoadPath = False
            for pathElement in self.rubyLoadPath:
                if path.startswith(pathElement):
                    foundInLoadPath = True
                    break
            if not foundInLoadPath:
                return

        # This is a very limited hack, but will work for the 90% case
        # better parsing may be written later
        # Note that we only honor "require" at the beginning of
        # the line and only requirements enclosed in single quotes
        # to avoid conditional requirements and requirements that
        # do any sort of substitution.  Because most ruby packages
        # contain multiple ruby modules, getting 90% of the ruby
        # dependencies will find most of the required packages in
        # practice
        depEntries = [x.strip() for x in file(fullpath)
                      if x.startswith('require ') or
                         x.startswith('require(')]
        depEntries = (x.split() for x in depEntries)
        depEntries = (x[1].strip("\"'") for x in depEntries
                      if len(x) == 2 and x[1].startswith("'") and
                                         x[1].endswith("'"))
        depEntries = set(depEntries)

        # I know of no way to ask ruby to report deps from scripts
        # Unfortunately, so far it seems that there are too many
        # Ruby modules which have code that runs in the body; this
        # code runs slowly, has not been useful in practice for
        # filtering out bogus dependencies, and has been hanging
        # and causing other unintended side effects from modules
        # that have code in the main body.
        #if not script:
        #    depClosure = util.popen(r'''%s -e "require '%s'; puts $\""'''
        #        %(self.rubyInvocation%macros, fullpath)).readlines()
        #    depClosure = set([x.split('.')[0] for x in depClosure])
        #    # remove any entries from the guessed immediate requirements
        #    # that are not in the closure
        #    depEntries = set(x for x in depEntries if x in depClosure)

        def _getDepEntryPath(depEntry):
            for prefix in (destdir, ''):
                for pathElement in self.rubyLoadPath:
                    for suffix in ('.rb', '.so'):
                        candidate = util.searchPath(
                            os.path.basename(depEntry) + suffix,
                            prefix + pathElement,
                            )
                        if candidate:
                            return candidate
            return None

        for depEntry in depEntries:
            depEntryPath = _getDepEntryPath(depEntry)
            if depEntryPath is None:
                continue
            if depEntryPath.startswith(destdir):
                depPath = depEntryPath[destDirLen:]
            else:
                depPath = depEntryPath
            flags = self._getRubyFlagsFromPath(depPath, self.rubyVersion)
            self._addRequirement(path, depEntry, flags, pkgFiles,
                                 deps.RubyDependencies)