class Aws::Templates::Help::Aggregate

Aggregated documentation provider

A composite which generates documentation for entities which have a few documentation aspects which must be assembled in the resulting piece. Documentation aspects must have their own documentation providers. Aggregate will assemble them all according to the specified ordering.

Public Class Methods

after(*mods) click to toggle source

DSL to declare aspects which should be displayed after entity-specific fragment

# File lib/aws/templates/help/aggregate.rb, line 20
def self.after(*mods)
  after_providers.concat(get_handlers_for(mods))
end
after_providers() click to toggle source

The list of aspects to be displayed after entity-specific fragment

# File lib/aws/templates/help/aggregate.rb, line 30
def self.after_providers
  @after_providers ||= superclass < Aggregate ? superclass.after_providers.dup : []
end
before(*mods) click to toggle source

DSL to declare aspects which should be displayed before entity-specific fragment

# File lib/aws/templates/help/aggregate.rb, line 15
def self.before(*mods)
  before_providers.concat(get_handlers_for(mods))
end
before_providers() click to toggle source

The list of aspects to be displayed before entity-specific fragment

# File lib/aws/templates/help/aggregate.rb, line 25
def self.before_providers
  @before_providers ||= superclass < Aggregate ? superclass.before_providers.dup : []
end
get_handlers_for(mods) click to toggle source

Get list of aspect handlers for the list of classes/modules

# File lib/aws/templates/help/aggregate.rb, line 45
def self.get_handlers_for(mods)
  mods.map { |mod| processor.handler_for(mod) }
end

Public Instance Methods

provide() click to toggle source
# File lib/aws/templates/help/aggregate.rb, line 34
def provide
  fragments = _process_through(self.class.before_providers)
              .push(fragment)
              .concat(_process_through(self.class.after_providers))

  fragments.compact!

  compose(fragments) unless fragments.empty?
end

Protected Instance Methods

compose(_fragments) click to toggle source

Compose documentation aspects

Implements inversion-of-control to provide implementation-specific way of composing documentation fragments

# File lib/aws/templates/help/aggregate.rb, line 56
def compose(_fragments)
  raise Templates::Exception::NotImplementedError.new('The method should be overriden')
end
fragment() click to toggle source

Entity-specific fragment

# File lib/aws/templates/help/aggregate.rb, line 62
def fragment
  raise Templates::Exception::NotImplementedError.new('The method should be overriden')
end

Private Instance Methods

_process_through(providers) click to toggle source
# File lib/aws/templates/help/aggregate.rb, line 68
def _process_through(providers)
  providers.map { |p| p.new(context, parameters).provide }
end