parameters: (self, sig, signode)
return_statement: return fullname, name_prefix
docstring: Transform a Ruby signature into RST nodes.
          Returns (fully qualified name of the thing, classname if any).
  
          If inside a class, the current class name is handled intelligently:
          * it is stripped from the displayed name if present
          * it is added to the full name (return value) if not present
docstring_summary: Transform a Ruby signature into RST nodes.
          Returns (fully qualified name of the thing, classname if any).
docstring_tokens: Transform a Ruby signature into RST nodes . Returns ( fully qualified name of the thing classname if any ) .
function: def handle_signature(self, sig, signode):
          """
          Transform a Ruby signature into RST nodes.
          Returns (fully qualified name of the thing, classname if any).
  
          If inside a class, the current class name is handled intelligently:
          * it is stripped from the displayed name if present
          * it is added to the full name (return value) if not present
          """
          m = rb_sig_re.match(sig)
          if m is None:
              raise ValueError
          name_prefix, name, arglist, retann = m.groups()
          if not name_prefix:
              name_prefix = ""
          # determine module and class name (if applicable), as well as full name
          modname = self.options.get(
              'module', self.env.temp_data.get('rb:module'))
          classname = self.env.temp_data.get('rb:class')
          if self.objtype == 'global':
              add_module = False
              modname = None
              classname = None
              fullname = name
          elif classname:
              add_module = False
              if name_prefix and name_prefix.startswith(classname):
                  fullname = name_prefix + name
                  # class name is given again in the signature
                  name_prefix = name_prefix[len(classname):].lstrip('.')
              else:
                  separator = separators[self.objtype]
                  fullname = classname + separator + name_prefix + name
          else:
              add_module = True
              if name_prefix:
                  classname = name_prefix.rstrip('.')
                  fullname = name_prefix + name
              else:
                  classname = ''
                  fullname = name
  
          signode['module'] = modname
          signode['class'] = self.class_name = classname
          signode['fullname'] = fullname
  
          sig_prefix = self.get_signature_prefix(sig)
          if sig_prefix:
              signode += addnodes.desc_annotation(sig_prefix, sig_prefix)
  
          if name_prefix:
              signode += addnodes.desc_addname(name_prefix, name_prefix)
          # exceptions are a special case, since they are documented in the
          # 'exceptions' module.
          elif add_module and self.env.config.add_module_names:
              if self.objtype == 'global':
                  nodetext = ''
                  signode += addnodes.desc_addname(nodetext, nodetext)
              else:
                  modname = self.options.get(
                      'module', self.env.temp_data.get('rb:module'))
                  if modname and modname != 'exceptions':
                      nodetext = modname + separators[self.objtype]
                      signode += addnodes.desc_addname(nodetext, nodetext)
  
          signode += addnodes.desc_name(name, name)
          if not arglist:
              if self.needs_arglist():
                  # for callables, add an empty parameter list
                  signode += addnodes.desc_parameterlist()
              if retann:
                  signode += addnodes.desc_returns(retann, retann)
              return fullname, name_prefix
          signode += addnodes.desc_parameterlist()
  
          stack = [signode[-1]]
          for token in rb_paramlist_re.split(arglist):
              if token == '[':
                  opt = addnodes.desc_optional()
                  stack[-1] += opt
                  stack.append(opt)
              elif token == ']':
                  try:
                      stack.pop()
                  except IndexError:
                      raise ValueError
              elif not token or token == ',' or token.isspace():
                  pass
              else:
                  token = token.strip()
                  stack[-1] += addnodes.desc_parameter(token, token)
          if len(stack) != 1:
              raise ValueError
          if retann:
              signode += addnodes.desc_returns(retann, retann)
          return fullname, name_prefix
function_tokens: def handle_signature ( self , sig , signode ) : m = rb_sig_re . match ( sig ) if m is None : raise ValueError name_prefix , name , arglist , retann = m . groups ( ) if not name_prefix : name_prefix = "" # determine module and class name (if applicable), as well as full name modname = self . options . get ( 'module' , self . env . temp_data . get ( 'rb:module' ) ) classname = self . env . temp_data . get ( 'rb:class' ) if self . objtype == 'global' : add_module = False modname = None classname = None fullname = name elif classname : add_module = False if name_prefix and name_prefix . startswith ( classname ) : fullname = name_prefix + name # class name is given again in the signature name_prefix = name_prefix [ len ( classname ) : ] . lstrip ( '.' ) else : separator = separators [ self . objtype ] fullname = classname + separator + name_prefix + name else : add_module = True if name_prefix : classname = name_prefix . rstrip ( '.' ) fullname = name_prefix + name else : classname = '' fullname = name signode [ 'module' ] = modname signode [ 'class' ] = self . class_name = classname signode [ 'fullname' ] = fullname sig_prefix = self . get_signature_prefix ( sig ) if sig_prefix : signode += addnodes . desc_annotation ( sig_prefix , sig_prefix ) if name_prefix : signode += addnodes . desc_addname ( name_prefix , name_prefix ) # exceptions are a special case, since they are documented in the # 'exceptions' module. elif add_module and self . env . config . add_module_names : if self . objtype == 'global' : nodetext = '' signode += addnodes . desc_addname ( nodetext , nodetext ) else : modname = self . options . get ( 'module' , self . env . temp_data . get ( 'rb:module' ) ) if modname and modname != 'exceptions' : nodetext = modname + separators [ self . objtype ] signode += addnodes . desc_addname ( nodetext , nodetext ) signode += addnodes . desc_name ( name , name ) if not arglist : if self . needs_arglist ( ) : # for callables, add an empty parameter list signode += addnodes . desc_parameterlist ( ) if retann : signode += addnodes . desc_returns ( retann , retann ) return fullname , name_prefix signode += addnodes . desc_parameterlist ( ) stack = [ signode [ - 1 ] ] for token in rb_paramlist_re . split ( arglist ) : if token == '[' : opt = addnodes . desc_optional ( ) stack [ - 1 ] += opt stack . append ( opt ) elif token == ']' : try : stack . pop ( ) except IndexError : raise ValueError elif not token or token == ',' or token . isspace ( ) : pass else : token = token . strip ( ) stack [ - 1 ] += addnodes . desc_parameter ( token , token ) if len ( stack ) != 1 : raise ValueError if retann : signode += addnodes . desc_returns ( retann , retann ) return fullname , name_prefix