Class | RDoc::AnyMethod |
In: |
code_objects.rb
|
Parent: | CodeObject |
AnyMethod is the base class for objects representing methods
aliases | [R] | |
block_params | [RW] | |
call_seq | [RW] | |
dont_rename_initialize | [RW] | |
is_alias_for | [RW] | |
name | [RW] | |
singleton | [RW] | |
visibility | [RW] |
# File code_objects.rb, line 799 799: def initialize(text, name) 800: super() 801: @text = text 802: @name = name 803: @token_stream = nil 804: @visibility = :public 805: @dont_rename_initialize = false 806: @block_params = nil 807: @aliases = [] 808: @is_alias_for = nil 809: @comment = "" 810: @call_seq = nil 811: end
# File code_objects.rb, line 813 813: def <=>(other) 814: t = @name <=> other.name 815: return t if t != 0 816: t = @params <=> other.params 817: return t if t != 0 818: t = @comment <=> other.comment 819: end
# File code_objects.rb, line 827 827: def param_seq 828: p = params.gsub(/\s*\#.*/, '') 829: p = p.tr("\n", " ").squeeze(" ") 830: p = "(" + p + ")" unless p[0] == ?( 831: 832: if (block = block_params) 833: # If this method has explicit block parameters, remove any 834: # explicit &block 835: $stderr.puts p 836: p.sub!(/,?\s*&\w+/) 837: $stderr.puts p 838: 839: block.gsub!(/\s*\#.*/, '') 840: block = block.tr("\n", " ").squeeze(" ") 841: if block[0] == ?( 842: block.sub!(/^\(/, '').sub!(/\)/, '') 843: end 844: p << " {|#{block}| ...}" 845: end 846: p 847: end