Class: RDocF95::AnyMethod
- Inherits:
-
CodeObject
- Object
- CodeObject
- RDocF95::AnyMethod
- Includes:
- TokenStream
- Defined in:
- lib/rdoc-f95/code_objects.rb,
lib/rdoc-f95/parsers/parse_f95.rb
Overview
Extend AnyMethod class for parse_f95.rb Original class is defined in code_objects.rb.
-
A method “<=>” is modified.
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
list of other names for this method.
-
#block_params ⇒ Object
Returns the value of attribute block_params.
-
#call_seq ⇒ Object
Returns the value of attribute call_seq.
-
#doc_priority ⇒ Object
readonly
Returns the value of attribute doc_priority.
-
#dont_rename_initialize ⇒ Object
Returns the value of attribute dont_rename_initialize.
-
#is_alias_for ⇒ Object
method we’re aliasing.
-
#name ⇒ Object
Returns the value of attribute name.
-
#singleton ⇒ Object
Returns the value of attribute singleton.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#visibility ⇒ Object
Returns the value of attribute visibility.
Attributes inherited from CodeObject
#comment, #document_children, #document_self, #done_documenting, #force_documentation, #parent, #section, #viewer
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #add_alias(method) ⇒ Object
-
#initialize(text, name) ⇒ AnyMethod
constructor
A new instance of AnyMethod.
- #param_seq ⇒ Object
- #set_priority(doc_priority) ⇒ Object
- #to_s ⇒ Object
Methods included from TokenStream
#add_token, #add_tokens, #pop_token, #start_collecting_tokens, #token_stream
Methods inherited from CodeObject
attr_overridable, #remove_classes_and_modules, #remove_methods_etc, #start_doc, #stop_doc
Constructor Details
#initialize(text, name) ⇒ AnyMethod
Returns a new instance of AnyMethod.
648 649 650 651 652 653 654 655 656 657 658 659 660 |
# File 'lib/rdoc-f95/code_objects.rb', line 648 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 |
Instance Attribute Details
#aliases ⇒ Object (readonly)
list of other names for this method
637 638 639 |
# File 'lib/rdoc-f95/code_objects.rb', line 637 def aliases @aliases end |
#block_params ⇒ Object
Returns the value of attribute block_params.
631 632 633 |
# File 'lib/rdoc-f95/code_objects.rb', line 631 def block_params @block_params end |
#call_seq ⇒ Object
Returns the value of attribute call_seq.
644 645 646 |
# File 'lib/rdoc-f95/code_objects.rb', line 644 def call_seq @call_seq end |
#doc_priority ⇒ Object (readonly)
Returns the value of attribute doc_priority.
547 548 549 |
# File 'lib/rdoc-f95/parsers/parse_f95.rb', line 547 def doc_priority @doc_priority end |
#dont_rename_initialize ⇒ Object
Returns the value of attribute dont_rename_initialize.
632 633 634 |
# File 'lib/rdoc-f95/code_objects.rb', line 632 def dont_rename_initialize @dont_rename_initialize end |
#is_alias_for ⇒ Object
method we’re aliasing
640 641 642 |
# File 'lib/rdoc-f95/code_objects.rb', line 640 def is_alias_for @is_alias_for end |
#name ⇒ Object
Returns the value of attribute name.
629 630 631 |
# File 'lib/rdoc-f95/code_objects.rb', line 629 def name @name end |
#singleton ⇒ Object
Returns the value of attribute singleton.
633 634 635 |
# File 'lib/rdoc-f95/code_objects.rb', line 633 def singleton @singleton end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
634 635 636 |
# File 'lib/rdoc-f95/code_objects.rb', line 634 def text @text end |
#visibility ⇒ Object
Returns the value of attribute visibility.
630 631 632 |
# File 'lib/rdoc-f95/code_objects.rb', line 630 def visibility @visibility end |
Instance Method Details
#<=>(other) ⇒ Object
662 663 664 |
# File 'lib/rdoc-f95/code_objects.rb', line 662 def <=>(other) @name <=> other.name end |
#add_alias(method) ⇒ Object
694 695 696 |
# File 'lib/rdoc-f95/code_objects.rb', line 694 def add_alias(method) @aliases << method end |
#param_seq ⇒ Object
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
# File 'lib/rdoc-f95/code_objects.rb', line 672 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 |
#set_priority(doc_priority) ⇒ Object
564 565 566 567 568 |
# File 'lib/rdoc-f95/parsers/parse_f95.rb', line 564 def set_priority(doc_priority) if doc_priority.class.to_s == 'Fixnum' @doc_priority = doc_priority end end |
#to_s ⇒ Object
666 667 668 669 670 |
# File 'lib/rdoc-f95/code_objects.rb', line 666 def to_s res = self.class.name + ": " + @name + " (" + @text + ")\n" res << @comment.to_s res end |