def initialize(apps, catch=404)
@apps = []; @has_app = {}
apps.each { |app| add app }
@catch = {}
[*catch].each { |status| @catch[status] = true }
end
I'm not sure anyone completely understands the splat operator. Many times it removes one level of "arrayness", but it won't remove the last level.
It is possible to get it in this one case, at least. It creates a single level of array for the catch parameter regardless of whether catch
is a single number or an array of numbers.
>> t = [*404]
=> [404]
>> t = [*[404,405,406]]
=> [404, 405, 406]