Bad XML parser produces hash for one element, array for >1

Stephen Paul Weber created

Change summary

.rubocop.yml                | 3 +++
lib/bandwidth_iris_patch.rb | 1 +
2 files changed, 4 insertions(+)

Detailed changes

.rubocop.yml 🔗

@@ -73,6 +73,9 @@ Layout/MultilineMethodCallIndentation:
 Style/AccessModifierDeclarations:
   Enabled: false
 
+Style/ArrayCoercion:
+  Enabled: false
+
 Style/StringLiterals:
   EnforcedStyle: double_quotes
 

lib/bandwidth_iris_patch.rb 🔗

@@ -21,6 +21,7 @@ module BandwidthIris
 		attr_reader :errors
 
 		def initialize(errors)
+			errors = [errors] unless errors.is_a?(Array)
 			super(errors.map { |e| e[:description] }.join("\n"))
 			@errors = errors
 		end