module Aws::Templates::Help
Abstract help generator
Implements basic functionality which is needed for programmatic help generation. Namely:
-
Module/entity class lookup
-
Final formatting
Public Instance Methods
format(_result, _params = nil)
click to toggle source
Formatting routine
Part of inversion-of-control. Must be overriden by a concrete implementation.
# 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)
click to toggle source
Generate help for the entity
# 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)
click to toggle source
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.
# File lib/aws/templates/help.rb, line 30 def show(entity, params = nil) format(process(entity, params), params) end