class Aws::Api::Docs::DocstringProvider

Public Class Methods

new(docstrings) click to toggle source
# File lib/aws-sdk-core/api/docs/docstring_provider.rb, line 6
def initialize(docstrings)
  @docstrings = docstrings
end

Public Instance Methods

operation_docs(operation_name) click to toggle source

@param [String] operation_name @return [String,nil]

# File lib/aws-sdk-core/api/docs/docstring_provider.rb, line 12
def operation_docs(operation_name)
  clean(@docstrings['operations'][operation_name])
end
shape_docs(shape_name) click to toggle source

@param [String] shape_name @return [String,nil]

# File lib/aws-sdk-core/api/docs/docstring_provider.rb, line 18
def shape_docs(shape_name)
  clean(shape(shape_name)['base'])
end
shape_ref_docs(shape_name, target) click to toggle source

@param [String] shape_name @param [String] target @return [String,nil]

# File lib/aws-sdk-core/api/docs/docstring_provider.rb, line 25
def shape_ref_docs(shape_name, target)
  if ref_docs = shape(shape_name)['refs'][target]
    clean(ref_docs)
  else
    shape_docs(shape_name)
  end
end

Private Instance Methods

clean(value) click to toggle source
# File lib/aws-sdk-core/api/docs/docstring_provider.rb, line 39
def clean(value)
  if value.nil?
    ''
  else
    value.gsub(/\{(\S+)\}/, '`{\1}`').strip
  end
end
shape(name) click to toggle source
# File lib/aws-sdk-core/api/docs/docstring_provider.rb, line 35
def shape(name)
  @docstrings['shapes'][name] || { 'base' => nil, 'refs' => {} }
end