<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>rubytips86</author_name>
  <author_url>https://blog.hatena.ne.jp/rubytips86/</author_url>
  <blog_title>Ruby Tips!</blog_title>
  <blog_url>https://rubytips86.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>Array#partitionを使えば、配列をブロックを満たす要素と、そうでない要素に分割した新しい配列を作ることができる。 p [1, 2, 3, 4, 5, 6].partition{|i| i % 2 == 0 } #=&gt; [[2, 4, 6], [1, 3, 5]] より高度な分割はArray#group_byで行える。このメソッドは、ブロックを評価した結果に基づいて、配列を複数の配列に分割しハッシュとして返す。 p [1, 2, 3, 4, 5, 6].group_by{|i| i % 3 } #=&gt; {1=&gt;[1, 4], 2=&gt;[2, 5], 0=&gt;[3, 6]}</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Frubytips86.hatenablog.com%2Fentry%2F2014%2F03%2F23%2F061852&quot; title=&quot;配列を条件に基づいて分割する - Ruby Tips!&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2014-03-23 06:18:52</published>
  <title>配列を条件に基づいて分割する</title>
  <type>rich</type>
  <url>https://rubytips86.hatenablog.com/entry/2014/03/23/061852</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
