enumerables.rb
def my_inject(*args)
    initial_value, symbol = args if args.length == 2
    symbol = args[0] if args.length == 1 && !block_given?
    initial_value = args[0] if args.length == 1 && block_given?

    return raise LocalJumpError, 'no block provided' if !block_given? && symbol.nil?

    if block_given?
      each do |i|
        if initial_value.nil?
          initial_value = i
          next
        end
        initial_value = yield(initial_value, i)
      end
    elsif (symbol && symbol.class == Symbol) || (symbol && symbol.class == String && %r{[-+*/]}.match(symbol))
      each do |i|
        if initial_value.nil?
          initial_value = i
          next
        end
        initial_value = initial_value.send(symbol, i)
      end

    end
    initial_value
  end
# // If no block is given and an arithmetic symbol or string is given without an initial value
# // If no block is given and an arithmetic symbol or string is given without an initial value
If no block is given and an arithmetic symbol or string is given without an initial value
If no block is given and an arithmetic symbol or string is given without an initial value
If no block is given and an arithmetic symbol or string is given without an initial value If no block is given and an arithmetic symbol or string is given without an initial value
def my_inject(*args)
    initial_value, symbol = args if args.length == 2
    symbol = args[0] if args.length == 1 && !block_given?
    initial_value = args[0] if args.length == 1 && block_given?
    return raise LocalJumpError, 'no block provided' if !block_given? && symbol.nil?
    if block_given?
      each do |i|
        if initial_value.nil?
          initial_value = i
          next
        end
        initial_value = yield(initial_value, i)
      end
    elsif (symbol && symbol.class == Symbol) || (symbol && symbol.class == String && %r{[-+*/]}.match(symbol))
      each do |i|
        if initial_value.nil?
          initial_value = i
          next
        end
        initial_value = initial_value.send(symbol, i)
      end
    end
    initial_value
  end
def my_inject ( * args ) initial_value , symbol = args if args . length == 2 symbol = args [ 0 ] if args . length == 1 && ! block_given? initial_value = args [ 0 ] if args . length == 1 && block_given? return raise LocalJumpError , 'no block provided' if ! block_given? && symbol . nil? if block_given? each do | i | if initial_value . nil? initial_value = i next end initial_value = yield ( initial_value , i ) end elsif ( symbol && symbol . class == Symbol ) || ( symbol && symbol . class == String && %r{ [-+*/] } . match ( symbol ) ) each do | i | if initial_value . nil? initial_value = i next end initial_value = initial_value . send ( symbol , i ) end end initial_value end
If no block is given and an arithmetic symbol or string is given without an initial value
 If no block is given and an arithmetic symbol or string is given without an initial value
If no block is given and an arithmetic symbol or string is given without an initial value If no block is given and an arithmetic symbol or string is given without an initial value
args