How to check if all elements of an array are of a certain value?
<p>I want a method to return <code>true</code> when all the elements of an array are equal and are <code>"yes"</code>. I have one array <code>["yes", "yes", "yes"]</code>. All its elements are the same <code>"yes"</code>. I want it to return <code>true</code>. For <code>["no", "no", "no"]</code>, although all the elements are <code>"no"</code>, the value is not equal to <code>"yes"</code>. How can I do that?</p>

<p>I am using this method to check this:</p>

<pre><code>def self.all_equal?(array) array.max == array.min end
</code></pre>

<p>but it returns <code>true</code> for <code>["no", "no", "no"]</code>.</p>