title: Ruby String variable returning true for .is_a?(Array)
body: <p>I have a method that will either get an array or a string</p>
  
  <p>For the method to work correctly, I need to convert that string to an array.
  Since it will sometimes get string, I wanted to have it check if the variable is an array, and if not convert it to an array. So I did the following:</p>
  
  <pre><code>unless variablename.is_a?(Array)
    variablename = variablename.lines.to_a
  end
  </code></pre>
  
  <p>The second line of this fails and I get a ruby error that 'lines' is not available to an array object.</p>
  
  <p>I also tried .kind_of? with same results</p>
  
  <p>I got my answer but I also wanted to clear up what exactly I was asking.
  I am testing to see if variablename is an array. For some reason when variablename is an array, it still runs and than the second line fails with the following error:
          undefined method `lines' for #Array:0x000000021382b8 (NoMethodError)</p>