lib/rspec_api_docs/formatter/resource.rb in rspec-api-docs-0.8.0 vs lib/rspec_api_docs/formatter/resource.rb in rspec-api-docs-0.9.0
- old
+ new
@@ -31,17 +31,26 @@
# Returns an array of {Example}s
#
# @return [Array<Example>]
def examples
- @examples.sort_by(&:name)
+ @examples.sort_by { |example| [example.precedence, example.name].join }
end
# Add an example
#
# @return [void]
def add_example(example)
@examples << example
+ end
+
+ # @return [String, nil]
+ def precedence
+ metadata[:resource_precedence]
+ end
+
+ def inspect
+ "#<RspecApiDocs::Resource #{name.inspect}, @examples=#{examples.inspect}>"
end
private
def metadata