def sum(identity = 0, &block)
      if block_given?
        map(&block).sum(identity)
      else
        inject { |sum, element| sum + element } || identity
      end
    end
def sum(identity = 0, &block)
      if block_given?
        map(&block).sum(identity)
      else
        inject { |sum, element| sum + element } || identity
      end
    end
Don't require numeric for this Array#sum. ActiveSupport uses it as well: ["foo", "bar"].sum #=> "foobar"