Module: Aws::Templates::Help

Includes:
Processor
Included in:
Rdoc
Defined in:
lib/aws/templates/help.rb,
lib/aws/templates/help/dsl.rb,
lib/aws/templates/help/rdoc.rb,
lib/aws/templates/help/provider.rb,
lib/aws/templates/help/rdoc/dsl.rb,
lib/aws/templates/help/aggregate.rb,
lib/aws/templates/help/rdoc/default.rb,
lib/aws/templates/help/rdoc/routing.rb,
lib/aws/templates/help/rdoc/texting.rb,
lib/aws/templates/help/rdoc/artifact.rb,
lib/aws/templates/help/rdoc/provider.rb,
lib/aws/templates/help/rdoc/composite.rb,
lib/aws/templates/help/rdoc/inheritable.rb,
lib/aws/templates/help/rdoc/parametrized.rb,
lib/aws/templates/help/rdoc/contextualized.rb,
lib/aws/templates/help/rdoc/default/provider.rb,
lib/aws/templates/help/rdoc/default/definition.rb,
lib/aws/templates/help/rdoc/parametrized/getter.rb,
lib/aws/templates/help/rdoc/parametrized/nested.rb,
lib/aws/templates/help/rdoc/parametrized/getters.rb,
lib/aws/templates/help/rdoc/contextualized/filter.rb,
lib/aws/templates/help/rdoc/parametrized/provider.rb,
lib/aws/templates/help/rdoc/contextualized/filters.rb,
lib/aws/templates/help/rdoc/parametrized/parameter.rb,
lib/aws/templates/help/rdoc/contextualized/provider.rb,
lib/aws/templates/help/rdoc/parametrized/constraint.rb,
lib/aws/templates/help/rdoc/parametrized/constraints.rb,
lib/aws/templates/help/rdoc/contextualized/filters/add.rb,
lib/aws/templates/help/rdoc/contextualized/filters/copy.rb,
lib/aws/templates/help/rdoc/parametrized/transformation.rb,
lib/aws/templates/help/rdoc/contextualized/filters/chain.rb,
lib/aws/templates/help/rdoc/contextualized/filters/proxy.rb,
lib/aws/templates/help/rdoc/parametrized/transformations.rb,
lib/aws/templates/help/rdoc/contextualized/filters/remove.rb,
lib/aws/templates/help/rdoc/contextualized/filters/scoped.rb,
lib/aws/templates/help/rdoc/parametrized/constraints/enum.rb,
lib/aws/templates/help/rdoc/contextualized/filters/identity.rb,
lib/aws/templates/help/rdoc/contextualized/filters/override.rb,
lib/aws/templates/help/rdoc/parametrized/constraints/all_of.rb,
lib/aws/templates/help/rdoc/parametrized/constraints/matches.rb,
lib/aws/templates/help/rdoc/parametrized/constraints/not_nil.rb,
lib/aws/templates/help/rdoc/parametrized/constraints/requires.rb,
lib/aws/templates/help/rdoc/parametrized/constraints/condition.rb,
lib/aws/templates/help/rdoc/parametrized/transformations/as_hash.rb,
lib/aws/templates/help/rdoc/parametrized/transformations/as_list.rb,
lib/aws/templates/help/rdoc/parametrized/transformations/as_chain.rb,
lib/aws/templates/help/rdoc/parametrized/transformations/as_module.rb,
lib/aws/templates/help/rdoc/parametrized/transformations/as_object.rb,
lib/aws/templates/help/rdoc/parametrized/transformations/as_string.rb,
lib/aws/templates/help/rdoc/parametrized/transformations/as_boolean.rb,
lib/aws/templates/help/rdoc/parametrized/transformations/as_integer.rb,
lib/aws/templates/help/rdoc/parametrized/transformations/as_rendered.rb,
lib/aws/templates/help/rdoc/parametrized/constraints/depends_on_value.rb,
lib/aws/templates/help/rdoc/parametrized/constraints/satisfies_condition.rb,
lib/aws/templates/help/rdoc/contextualized/filters/recursive_schema_filter.rb

Overview

Abstract help generator

Implements basic functionality which is needed for programmatic help generation. Namely:

  • Module/entity class lookup

  • Final formatting

Defined Under Namespace

Modules: Dsl, Rdoc Classes: Aggregate, Provider

Instance Method Summary collapse

Methods included from Processor

#define_handler, #handler?, #handler_for, #routing

Methods included from Processor::Routing

#register, #registry

Instance Method Details

#format(_result, _params = nil) ⇒ Object

Formatting routine

Part of inversion-of-control. Must be overriden by a concrete implementation.

Raises:

  • (Templates::Exception::NotImplementedError)


38
39
40
# File 'lib/aws/templates/help.rb', line 38

def format(_result, _params = nil)
  raise Templates::Exception::NotImplementedError.new('The method should be overriden')
end

#process(entity, params = nil) ⇒ Object

Generate help for the entity



17
18
19
20
21
22
23
# File 'lib/aws/templates/help.rb', line 17

def process(entity, params = nil)
  ancestors_list = entity.is_a?(::Module) ? entity.ancestors : entity.class.ancestors
  ancestor = ancestors_list.find { |mod| handler?(mod) }
  return unless ancestor

  handler_for(ancestor).new(entity, params).provide
end

#show(entity, params = nil) ⇒ Object

Generate help structure and format it

It returns ready-to-be-displayed blob in specific format. Essentially, it processes entity and then formats the output of the processing.



30
31
32
# File 'lib/aws/templates/help.rb', line 30

def show(entity, params = nil)
  format(process(entity, params), params)
end