Class: RDoc::AnyMethod

Class | RDoc::AnyMethod
In: | rdoc/code_objects.rb
Parent: | CodeObject

AnyMethod is the base class for objects representing methods

### Methods

<=> add_alias new param_seq to_s

### Included Modules

TokenStream

### Attributes

aliases | [R] |
block_params | [RW] |
call_seq | [RW] |
dont_rename_initialize | [RW] |
is_alias_for | [RW] |
name | [RW] |
singleton | [RW] |
visibility | [RW] |

### Public Class methods

new(text, name)

[Source]

    # File rdoc/code_objects.rb, line 636
        def initialize(text, name)
          super()
          @text = text
          @name = name
          @token_stream  = nil
          @visibility    = :public
          @dont_rename_initialize = false
          @block_params  = nil
          @aliases       = []
          @is_alias_for  = nil
          @comment = ""
          @call_seq = nil
        end

### Public Instance methods

<=>(other)

[Source]

    # File rdoc/code_objects.rb, line 650
        def <=>(other)
          @name <=> other.name
        end

add_alias(method)

[Source]

    # File rdoc/code_objects.rb, line 682
        def add_alias(method)
          @aliases << method
        end

param_seq()

[Source]

    # File rdoc/code_objects.rb, line 660
        def param_seq
          p = params.gsub(/\s*\#.*/, '')
          p = p.tr("\n", " ").squeeze(" ")
          p = "(" + p + ")" unless p[0] == ?(

          if (block = block_params)
            # If this method has explicit block parameters, remove any
            # explicit &block
    $stderr.puts p
            p.sub!(/,?\s*&\w+/)
    $stderr.puts p

            block.gsub!(/\s*\#.*/, '')
            block = block.tr("\n", " ").squeeze(" ")
            if block[0] == ?(
              block.sub!(/^\(/, '').sub!(/\)/, '')
            end
            p << " {|#{block}| ...}"
          end
          p
        end

to_s()

[Source]

    # File rdoc/code_objects.rb, line 654
        def to_s
          res = self.class.name + ": " + @name + " (" + @text + ")\n"
          res << @comment.to_s
          res
        end

[Validate]