lib/trav3/response/response_collection.rb in trav3-0.5.0 vs lib/trav3/response/response_collection.rb in trav3-0.5.1
- old
+ new
@@ -140,9 +140,19 @@
# @return [ResponseCollection, String, nil]
def last
self[-1]
end
+ # If `@warnings` was returned with the response this will return
+ # a `ResponseCollection` instance of them. Otherwise this returns `nil`.
+ #
+ # @return [ResponseCollection, nil]
+ def warnings
+ return nil unless hash?
+
+ self['@warnings']
+ end
+
private
def collection?(input)
[Array, Hash].include? input.class
end