Commit 324362c4 authored by Sam Bingner's avatar Sam Bingner Committed by Arturo Herrero

Use case instead of if/else statement

parent b647ee79
...@@ -65,13 +65,11 @@ class DiscordService < ChatNotificationService ...@@ -65,13 +65,11 @@ class DiscordService < ChatNotificationService
super(data).merge(markdown: true) super(data).merge(markdown: true)
end end
def wrap_array object def wrap_array(object)
if object.nil? case(object)
[] when nil then []
elsif object.respond_to?(:to_ary) when object.respond_to?(:to_a) then object.to_a
object.to_ary || [object] else [object]
else
[object]
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment