Sha256: 2ccdfff298f58af637d796217668d23509499e430b5c305ee8ad56ca66005af5
Contents?: true
Size: 1.34 KB
Versions: 57
Compression:
Stored size: 1.34 KB
Contents
module Aws module Api module Docs class DocstringProvider def initialize(docstrings) @docstrings = docstrings end # @param [String] operation_name # @return [String,nil] def operation_docs(operation_name) clean(@docstrings['operations'][operation_name]) end # @param [String] shape_name # @return [String,nil] def shape_docs(shape_name) clean(shape(shape_name)['base']) end # @param [String] shape_name # @param [String] target # @return [String,nil] 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 def shape(name) @docstrings['shapes'][name] || { 'base' => nil, 'refs' => {} } end def clean(value) if value.nil? '' else value.gsub(/\{(\S+)\}/, '`{\1}`').strip end end end class NullDocstringProvider def operation_docs(operation_name) nil end def shape_docs(shape_name) nil end def shape_ref_docs(shape_name, target) nil end end end end end
Version data entries
57 entries across 57 versions & 1 rubygems