class Aws::Templates::Help::Rdoc::Inheritable

Common functionality for documenting inheritable properties.

Examples of inheritable properties:

Those have one thing in common: they are inherited from a parent class to any child and to generate full documentation you need to go over all of them respecting class/module hierarchy. The class implements utility methods and provides IoC stubs to define specific behaviors with ease.

Public Class Methods

header(header = nil) click to toggle source
# File lib/aws/templates/help/rdoc/inheritable.rb, line 18
def self.header(header = nil)
  return @header if header.nil?
  @header = header
end

Public Instance Methods

provide() click to toggle source
# File lib/aws/templates/help/rdoc/inheritable.rb, line 23
def provide
  desc = ancestors_description
  sub(text(self.class.header.gsub(/(\S+)/, '_\1_')), desc) if desc
end

Protected Instance Methods

description_for(_mod) click to toggle source
# File lib/aws/templates/help/rdoc/inheritable.rb, line 30
def description_for(_mod)
  raise Templates::Exception::NotImplementedError.new('The method should be overriden')
end

Private Instance Methods

ancestors_description() click to toggle source
# File lib/aws/templates/help/rdoc/inheritable.rb, line 36
def ancestors_description
  descriptions = context.ancestors_with(self.class.entity)
                        .map { |mod| description_for(mod) }
                        .reject(&:nil?)
                        .to_a

  list(:BULLET, *descriptions) unless descriptions.empty?
end