Class: Aws::Resources::Documenter::HasManyOperationDocumenter

Inherits:
BaseOperationDocumenter show all
Defined in:
aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb

Instance Attribute Summary

Attributes inherited from BaseOperationDocumenter

#api_request, #api_request_name, #api_request_params, #builder, #called_operation, #operation_name, #resource_class, #resource_class_name, #source, #target_resource_class, #target_resource_class_name, #yard_class

Instance Method Summary collapse

Methods inherited from BaseOperationDocumenter

#initialize, #method_object

Constructor Details

This class inherits a constructor from Aws::Resources::Documenter::BaseOperationDocumenter

Instance Method Details

#batch_examplesObject


49
50
51
52
53
54
55
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 49

def batch_examples
  example = "@example Batch operations callable on the returned collection"
  target_resource_batch_operations.each do |name|
    example << "\n  #{variable_name}.#{@operation_name}.#{name}"
  end
  example
end

#docstringObject


6
7
8
9
10
11
12
13
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 6

def docstring
  super + ' ' +"Returns a {Resources::Collection Collection} of {\#{target_resource_class_name}}\nresources. No API requests are made until you call an enumerable method on the\ncollection. {\#{called_operation}} will be called multiple times until every\n{\#{target_resource_class_name}} has been yielded.\n".lstrip
end

#enumerate_exampleObject


31
32
33
34
35
36
37
38
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 31

def enumerate_example
  return "@example Enumerating {\#{target_resource_class_name}} resources.\n  \#{variable_name}.\#{@operation_name}.each do |\#{target_resource_class_name.downcase}|\n    # yields each \#{target_resource_class_name.downcase}\n  end\n"
end

#enumerate_with_limit_exampleObject


40
41
42
43
44
45
46
47
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 40

def enumerate_with_limit_example
  return "@example Enumerating {\#{target_resource_class_name}} resources with a limit.\n  \#{variable_name}.\#{@operation_name}.limit(10).each do |\#{target_resource_class_name.downcase}|\n    # yields at most 10 \#{@operation_name}\n  end\n"
end

#example_tagsObject


23
24
25
26
27
28
29
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 23

def example_tags
  tags = []
  tags << enumerate_example
  tags << enumerate_with_limit_example
  tags << batch_examples if target_resource_batches?
  YARD::DocstringParser.new.parse(tags.join("\n")).to_docstring.tags
end

#return_messageObject


19
20
21
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 19

def return_message
  "a {Aws::Resources::Collection Collection} of {#{target_resource_class_name}} resource objects."
end

#return_typeObject


15
16
17
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 15

def return_type
  ["Collection<#{target_resource_class_name}>"]
end

#target_resource_batch_operationsObject


62
63
64
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 62

def target_resource_batch_operations
  target_resource_class::Batch.operation_names
end

#target_resource_batches?Boolean


57
58
59
60
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 57

def target_resource_batches?
  target_resource_class.const_defined?(:Batch) &&
  target_resource_batch_operations.count > 0
end