Sha256: d3733a995a2c10b821784c87d8b432b8882d589bcd21011d7de75ebc64b3a645

Contents?: true

Size: 1.35 KB

Versions: 88

Compression:

Stored size: 1.35 KB

Contents

module Aws
  module Resources
    class Documenter
      class HasOperationDocumenter < BaseOperationDocumenter

        def return_tag
          if plural?
            type = "Array<#{target_resource_class_name}>"
          else
            type = target_resource_class_name
          end
          type += ',nil' if can_return_nil?
          tag("@return [#{type}]")
        end

        def parameters
          if argument?
            [[argument_name, nil]]
          else
            []
          end
        end

        def tags
          tags = super
          if argument?
            tag = "@param [String] #{argument_name} "
            tag << "The {#{target_resource_class_name}##{argument_name}} "
            tag << "identifier."
            tags += YARD::DocstringParser.new.parse(tag).to_docstring.tags
          end
          tags
        end

        def plural?
          @operation.builder.plural?
        end

        def argument?
          @operation.arity > 0
        end

        def can_return_nil?
          data_member
        end

        def data_member
          builder.sources.find { |s| BuilderSources::DataMember === s }
        end

        def argument_name
          argument = builder.sources.find do |source|
            BuilderSources::Argument === source
          end
          argument.target.to_s
        end

      end
    end
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
aws-sdk-resources-2.3.14 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.13 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.12 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.11 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.10 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.9 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.8 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.7 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.6 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.5 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.4 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.3 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.2 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.1 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.3.0 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.2.37 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.2.36 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.2.35 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.2.34 lib/aws-sdk-resources/documenter/has_operation_documenter.rb
aws-sdk-resources-2.2.33 lib/aws-sdk-resources/documenter/has_operation_documenter.rb