title: using a string or key-val pair as a method argument
body: <p>Is there a better way to write this? basically I want to add an argument to a hash. if the argument is a key-val pair, then id like to add it as is. if the argument is a string i'd like to add it as a key with a nil value. the below code works, but is there a more appropriate (simple) way?</p>
  
  <p>2nd question, does calling an each method on an array with two arguments |key, val| automatically convert an array to a hash as it appears to? </p>
  
  <pre class="lang-ruby prettyprint-override"><code>@some_hash = {}
  
  def some_method(input)
      if input.is_a? Hash
          input.each {|key, val| @some_hash[key] = val}
      else
          input.split(" ").each {|key, val| @some_hash[key] = val}
      end
  end
  
  some_method("key" =&gt; "val")
  </code></pre>