Class: RDoc::Generator::Mdoc::Section
- Inherits:
-
Object
- Object
- RDoc::Generator::Mdoc::Section
- Defined in:
- lib/rdoc/generator/mdoc/section.rb
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
- #constants ⇒ Object
- #described? ⇒ Boolean
- #description ⇒ Object
-
#initialize(rdoc_section, rdoc_constants, rdoc_attributes, mandb_section, parent) ⇒ Section
constructor
A new instance of Section.
- #methods ⇒ Object
- #methods_of_type(type) ⇒ Object
- #title ⇒ Object
- #titled? ⇒ Boolean
Constructor Details
#initialize(rdoc_section, rdoc_constants, rdoc_attributes, mandb_section, parent) ⇒ Section
Returns a new instance of Section.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 12 def initialize( rdoc_section, rdoc_constants, rdoc_attributes, mandb_section, parent ) @rdoc_section = rdoc_section @rdoc_constants = rdoc_constants @rdoc_attributes = rdoc_attributes @mandb_section = mandb_section @parent = parent end |
Class Method Details
.method_types ⇒ Object
8 9 10 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 8 def self.method_types [:class, :instance] end |
Instance Method Details
#attributes ⇒ Object
48 49 50 51 52 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 48 def attributes @attributes ||= rdoc_attributes.map do |rdoc_attribute| Attribute.new(rdoc_attribute) end end |
#constants ⇒ Object
42 43 44 45 46 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 42 def constants @constants ||= rdoc_constants.map do |rdoc_constant| Constant.new(rdoc_constant) end end |
#described? ⇒ Boolean
34 35 36 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 34 def described? !description.empty? end |
#description ⇒ Object
38 39 40 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 38 def description comment.mdoc_formatted_content end |
#methods ⇒ Object
54 55 56 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 54 def methods self.class.method_types.flat_map { |type| methods_of_type(type) } end |
#methods_of_type(type) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 58 def methods_of_type(type) @methods_of_type ||= {} @methods_of_type[type] ||= parent. methods_by_type(rdoc_section)[type.to_s]. flat_map do |visibility, rdoc_methods| rdoc_methods.select do |rdoc_method| rdoc_method.is_a? RDoc::AnyMethod end.map do |rdoc_method| Method.new(rdoc_method, mandb_section, visibility) end end end |
#title ⇒ Object
30 31 32 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 30 def title rdoc_section.title end |
#titled? ⇒ Boolean
26 27 28 |
# File 'lib/rdoc/generator/mdoc/section.rb', line 26 def titled? !title.nil? end |