lib/useless/doc/core/body.rb in useless-doc-0.6.5 vs lib/useless/doc/core/body.rb in useless-doc-0.7.0
- old
+ new
@@ -32,27 +32,34 @@
# @return [String] one of "string", "number", "object",
# "array", or "boolean". "string" is the default value.
#
# @!attribute [r] required
# @return [Boolean] whether or not the attribute is required. If it
- # is required, and the attribute is omitted, the response should have
- # a 4xx code. +true+ is the default value.
+ # is required, and the attribute is omitted, the response should
+ # have a 4xx code. +true+ is the default value.
#
# @!attribute [r] description
# @return [String] a description of the attribute.
#
+ # @!attribute [r] attributes
+ # @return [Array<Body::Attribute>] documentation for the
+ # sub-attributes of this attribute. An empty array is the default
+ # value.
+ #
class Attribute
- attr_reader :key, :type, :required, :default, :description
+ attr_reader :key, :type, :required, :default, :description,
+ :attributes
# @param [Hash] attrs corresponds to the class's instance attributes.
#
def initialize(attrs)
@key = attrs[:key]
@type = attrs[:type] || 'string'
@required = attrs.key?(:required) ? attrs[:required] : true
@default = attrs[:default]
@description = attrs[:description]
+ @attributes = attrs[:attributes] || []
end
end
end
end
end