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 751
751:     def initialize(text, name)
752:       super()
753:       @text = text
754:       @name = name
755:       @token_stream  = nil
756:       @visibility    = :public
757:       @dont_rename_initialize = false
758:       @block_params  = nil
759:       @aliases       = []
760:       @is_alias_for  = nil
761:       @comment = ""
762:       @call_seq = nil
763:     end

Public Instance methods

[Source]

     # File code_objects.rb, line 765
765:     def <=>(other)
766:       t = @name <=> other.name
767:       return t if t != 0
768:       t = @params <=> other.params
769:       return t if t != 0
770:       t = @comment <=> other.comment
771:     end

[Source]

     # File code_objects.rb, line 801
801:     def add_alias(method)
802:       @aliases << method
803:     end

[Source]

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

[Source]

     # File code_objects.rb, line 773
773:     def to_s
774:       res = self.class.name + ": " + @name + " (" + @text + ")\n"
775:       res << @comment.to_s
776:       res
777:     end

[Validate]