title: Find element(s) closest to average of array
body: <p>What would be a 'ruby' way to do the following; I'm still thinking in more imperative style programming and not really adapting to thinking in ruby. What I want to do is find the closest element in size to the average of an array, for example, consider the following array</p>
  
  <pre><code>[1,2,3] 
  </code></pre>
  
  <p>The average is 2.0. The method I want to write returns the element closest to the average from above and below it, in this case 1 and 3.</p>
  
  <p>Another example will illustrate this better:</p>
  
  <pre><code>[10,20,50,33,22] avg is 27.0 method would return 22 and 33.
  </code></pre>