Class: Aws::Resources::Documenter::HasManyOperationDocumenter
Instance Attribute Summary
#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
#initialize, #method_object
Instance Method Details
#batch_examples ⇒ Object
49
50
51
52
53
54
55
|
# File '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
|
#docstring ⇒ Object
6
7
8
9
10
11
12
13
|
# File '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_example ⇒ Object
31
32
33
34
35
36
37
38
|
# File '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_example ⇒ Object
40
41
42
43
44
45
46
47
|
# File '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
|
23
24
25
26
27
28
29
|
# File '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_message ⇒ Object
19
20
21
|
# File '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_type ⇒ Object
15
16
17
|
# File 'lib/aws-sdk-resources/documenter/has_many_operation_documenter.rb', line 15
def return_type
["Collection<#{target_resource_class_name}>"]
end
|
#target_resource_batch_operations ⇒ Object
62
63
64
|
# File '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 '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
|