Class: RDoc::Generator::Mdoc::Method
- Inherits:
-
Object
- Object
- RDoc::Generator::Mdoc::Method
- Defined in:
- lib/rdoc/generator/mdoc/method.rb
Instance Attribute Summary collapse
-
#mandb_section ⇒ Object
readonly
Returns the value of attribute mandb_section.
-
#visibility ⇒ Object
readonly
Returns the value of attribute visibility.
Instance Method Summary collapse
- #alias? ⇒ Boolean
- #aliased? ⇒ Boolean
- #aliased_method ⇒ Object
- #aliases ⇒ Object
- #calls_super? ⇒ Boolean
- #described? ⇒ Boolean
- #description ⇒ Object
- #full_name ⇒ Object
- #has_invocation_examples? ⇒ Boolean
- #has_source? ⇒ Boolean
-
#initialize(rdoc_method, mandb_section, visibility = nil) ⇒ Method
constructor
A new instance of Method.
- #invocation_examples ⇒ Object
- #name ⇒ Object
- #object ⇒ Object
- #parameters ⇒ Object
- #reference ⇒ Object
- #short_description ⇒ Object
- #source ⇒ Object
- #superclass_method ⇒ Object
Constructor Details
#initialize(rdoc_method, mandb_section, visibility = nil) ⇒ Method
Returns a new instance of Method.
8 9 10 11 12 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 8 def initialize(rdoc_method, mandb_section, visibility = nil) @rdoc_method = rdoc_method @mandb_section = mandb_section @visibility = visibility.to_s end |
Instance Attribute Details
#mandb_section ⇒ Object (readonly)
Returns the value of attribute mandb_section.
6 7 8 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 6 def mandb_section @mandb_section end |
#visibility ⇒ Object (readonly)
Returns the value of attribute visibility.
6 7 8 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 6 def visibility @visibility end |
Instance Method Details
#alias? ⇒ Boolean
72 73 74 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 72 def alias? !aliased_method.nil? end |
#aliased? ⇒ Boolean
81 82 83 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 81 def aliased? !aliases.empty? end |
#aliased_method ⇒ Object
76 77 78 79 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 76 def aliased_method @aliased_method ||= rdoc_method.is_alias_for && self.class.new(rdoc_method.is_alias_for, mandb_section) end |
#aliases ⇒ Object
85 86 87 88 89 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 85 def aliases @aliases ||= rdoc_method.aliases.map do |_alias| self.class.new(_alias, mandb_section) end end |
#calls_super? ⇒ Boolean
54 55 56 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 54 def calls_super? !superclass_method.nil? end |
#described? ⇒ Boolean
34 35 36 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 34 def described? !description.empty? end |
#description ⇒ Object
38 39 40 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 38 def description comment.mdoc_formatted_content end |
#full_name ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 18 def full_name @full_name ||= if class_method? replace_last_double_colon_with_dot(rdoc_method.full_name) else rdoc_method.full_name end end |
#has_invocation_examples? ⇒ Boolean
42 43 44 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 42 def has_invocation_examples? !invocation_examples.empty? end |
#has_source? ⇒ Boolean
63 64 65 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 63 def has_source? !source.nil? end |
#invocation_examples ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 46 def invocation_examples @invocation_examples ||= if rdoc_method.call_seq.nil? [] else extract_invocation_examples(rdoc_method.call_seq) end end |
#name ⇒ Object
14 15 16 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 14 def name rdoc_method.name end |
#object ⇒ Object
95 96 97 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 95 def object @object ||= Module.new(rdoc_method.parent, mandb_section) end |
#parameters ⇒ Object
26 27 28 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 26 def parameters rdoc_method.params.to_s.gsub(/[\(\)]/, '').split(", ") end |
#reference ⇒ Object
91 92 93 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 91 def reference "#{full_name} #{mandb_section}" end |
#short_description ⇒ Object
30 31 32 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 30 def short_description comment.first_paragraph.truncate(50) end |
#source ⇒ Object
67 68 69 70 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 67 def source @source ||= rdoc_method.token_stream && strip_source_file_path(extract_source(rdoc_method.token_stream)) end |
#superclass_method ⇒ Object
58 59 60 61 |
# File 'lib/rdoc/generator/mdoc/method.rb', line 58 def superclass_method @superclass_method ||= rdoc_method.superclass_method && self.class.new(rdoc_method.superclass_method, mandb_section) end |