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
super(data).merge(markdown: true)
end
def wrap_array object
if object.nil?
[]
elsif object.respond_to?(:to_ary)
object.to_ary || [object]
else
[object]
def wrap_array(object)
case(object)
when nil then []
when object.respond_to?(:to_a) then object.to_a
else [object]
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