I'm new to ruby and was going though a piece of code
scope_value = {"tickets_scope"=>"1", "changes_scope"=>"8", "solutions_scope"=>"15"}
scope_value.values.map { |i| 2** i.to_i }.inject(0, :|)
I realised
scope_value.values.map {|i| 2** i.to_i }.sum
does the the same thing as well
In terms of functionality doesn't both lines of code do the same thing. Is there any advantage to using sum over the other in terms of performance.