<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>round-rand</author_name>
  <author_url>https://blog.hatena.ne.jp/round-rand/</author_url>
  <blog_title>ランドML</blog_title>
  <blog_url>https://ml-rand-note.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>partitionメソッドとは？ 条件を満たす要素と満たさない要素を同時に取得できるメソッドです。 条件を満たす or 満たさない要素のみを取得したい場合はselectやrejectで取得できますが、どちらも取得したい場合にはpartitionを使います。 条件を満たす配列, 条件を満たさない配列 = 配列.partition { |item| 条件 } partitionの使用例1：偶数と奇数に分ける ary = [1, 2, 3, 4, 5, 6] evens, odds = ary.partition(&amp;:even?) p evens #=&gt; [2, 4, 6] p odds #=&gt; […</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fml-rand-note.hatenablog.com%2Fentry%2Fruby%2Fpartition&quot; title=&quot;【Ruby】partitionの使い方 - ランドML&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>2026-06-10 00:00:00</published>
  <title>【Ruby】partitionの使い方</title>
  <type>rich</type>
  <url>https://ml-rand-note.hatenablog.com/entry/ruby/partition</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
