"letra_procurada" means "letter wanted", so you seem to be under the impression that you have to pass the element you're looking for to select like this:
letra_procurada = "a"
palavra_secreta_array.each_with_index.select { |letra_procurada, index| }
# ^^^^^^^^^^^^^^^
However, this is not at all how block arguments or select in particular work. If you would replace letra_procurada by a string literal, you'd get a SyntaxError right-away:
palavra_secreta_array.each_with_index.select { |"a", index| }
# SyntaxError: unexpected string literal
A block contains code that the method you pass the block to (here: select) can invoke (multiple times, just once or not at all). Upon each block invocation, the block arguments (|letra_procurada, index|) are passed from the method (i.e. from select) into the block.
You call select, but select calls the block. This is also known as a "callback".
In your example, select invokes the block for each element and passes that element as the block arguments letra_procurada and index. It then expects the block to return either true or false. That return value determines whether or not that element will be included in the result.
Since the block's first argument can be any letter, you likely want a more general variable name. Something like this:
palavra_secreta_array.each_with_index.select { |letra, index|
# ...
}
Some examples might help to understand this. To select only elements with an odd? index:
palavra_secreta_array.each_with_index.select { |letra, index|
index.odd?
}
#=> [["r", 1], ["g", 3], ["a", 5], ["a", 7], ["o", 9]]
To select only elements whose letter is equal to "r" or equal to "o": (|| means "or")
palavra_secreta_array.each_with_index.select { |letra, index|
letra == "r" || letra == "o"
}
#=> [["r", 1], ["o", 2], ["r", 4], ["o", 9], ["r", 10]]
Or combined, to select only elements with a letter of "r" or "o" and an odd index: (&& means "and")
palavra_secreta_array.each_with_index.select { |letra, index|
(letra == "r" || letra == "o") && index.odd?
}
#=> [["r", 1], ["o", 9]]
As you can see, using a block is a very flexible and powerful way to select elements.
Back to your problem. Your current block just checks whether total_encontrado is larger or equal to 1. It doesn't take the current letter or its index into account. And because total_encontrado is larger than 1, the block always returns true and select returns all elements.
To select only elements whose letter match the wanted letter letra_procurada, you'd use:
palavra_secreta_array.each_with_index.select { |letra, index|
letra == letra_procurada
}
#=> [["a", 5], ["a", 7]]