Class: Aws::Resources::Documenter::ResourceOperationDocumenter
- Inherits:
-
BaseOperationDocumenter
- Object
- BaseOperationDocumenter
- Aws::Resources::Documenter::ResourceOperationDocumenter
- Defined in:
- lib/aws-sdk-resources/documenter/resource_operation_documenter.rb
Instance Attribute Summary collapse
-
#plural ⇒ Boolean
(also: #plural?)
readonly
Returns ‘true` if this operation returns an array of resource objects.
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
- #example_tags ⇒ Object
-
#initialize(*args) ⇒ ResourceOperationDocumenter
constructor
A new instance of ResourceOperationDocumenter.
- #resp_variable ⇒ Object
- #return_tag ⇒ Object
Methods inherited from BaseOperationDocumenter
Constructor Details
#initialize(*args) ⇒ ResourceOperationDocumenter
Returns a new instance of ResourceOperationDocumenter.
6 7 8 9 |
# File 'lib/aws-sdk-resources/documenter/resource_operation_documenter.rb', line 6 def initialize(*args) super @plural = @operation.builder.plural? end |
Instance Attribute Details
#plural ⇒ Boolean (readonly) Also known as: plural?
Returns ‘true` if this operation returns an array of resource objects. Returns `false` if this method returns a single resource object.
14 15 16 |
# File 'lib/aws-sdk-resources/documenter/resource_operation_documenter.rb', line 14 def plural @plural end |
Instance Method Details
#example_tags ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/aws-sdk-resources/documenter/resource_operation_documenter.rb', line 26 def id = target_resource_class.identifiers.last.to_s idv = target_resource_class_name.downcase + '-' + id.gsub('_', '-') example = [] example << "@example Basic usage" example << " #{resp_variable} = #{variable_name}.#{operation_name}(options)" if plural? example << " #{resp_variable}.map(&:#{id})" example << " #=> [#{idv.inspect}, ...]" else example << " #{resp_variable}.#{id}" example << " #=> #{idv.inspect}" end super + [tag(example.join("\n"))] end |
#resp_variable ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/aws-sdk-resources/documenter/resource_operation_documenter.rb', line 42 def resp_variable if plural? target_resource_class_name.downcase + 's' else target_resource_class_name.downcase end end |
#return_tag ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/aws-sdk-resources/documenter/resource_operation_documenter.rb', line 18 def return_tag if plural? tag("@return [Array<#{target_resource_class_name}>]") else tag("@return [#{target_resource_class_name}]") end end |