Class RDoc::AnyMethod
In: 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

[Source]

     # File code_objects.rb, line 747
747:     def initialize(text, name)
748:       super()
749:       @text = text
750:       @name = name
751:       @token_stream  = nil
752:       @visibility    = :public
753:       @dont_rename_initialize = false
754:       @block_params  = nil
755:       @aliases       = []
756:       @is_alias_for  = nil
757:       @comment = ""
758:       @call_seq = nil
759:     end

Public Instance methods

[Source]

     # File code_objects.rb, line 761
761:     def <=>(other)
762:       t = @name <=> other.name
763:       return t if t != 0
764:       t = @params <=> other.params
765:       return t if t != 0
766:       t = @comment <=> other.comment
767:     end

[Source]

     # File code_objects.rb, line 797
797:     def add_alias(method)
798:       @aliases << method
799:     end

[Source]

     # File code_objects.rb, line 775
775:     def param_seq
776:       p = params.gsub(/\s*\#.*/, '')
777:       p = p.tr("\n", " ").squeeze(" ")
778:       p = "(" + p + ")" unless p[0] == ?(
779: 
780:       if (block = block_params)
781:         # If this method has explicit block parameters, remove any
782:         # explicit &block
783: $stderr.puts p
784:         p.sub!(/,?\s*&\w+/)
785: $stderr.puts p
786: 
787:         block.gsub!(/\s*\#.*/, '')
788:         block = block.tr("\n", " ").squeeze(" ")
789:         if block[0] == ?(
790:           block.sub!(/^\(/, '').sub!(/\)/, '')
791:         end
792:         p << " {|#{block}| ...}"
793:       end
794:       p
795:     end

[Source]

     # File code_objects.rb, line 769
769:     def to_s
770:       res = self.class.name + ": " + @name + " (" + @text + ")\n"
771:       res << @comment.to_s
772:       res
773:     end

[Validate]