<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hkdnet</author_name>
  <author_url>https://blog.hatena.ne.jp/hkdnet/</author_url>
  <blog_title>Smoky God Express</blog_title>
  <blog_url>https://hkdnet.hatenablog.com/</blog_url>
  <categories>
    <anon>技術系日記</anon>
    <anon>Ruby</anon>
  </categories>
  <description>どうするのがいいんでしょうか。 メモリとかパフォーマンスとかそういうのはあんまり気にしない前提です。 以下のサンプルコードでは対象のEnumerableは変数 arr に代入されているものとし、条件Xを満たすかどうかのメソッドは foo?(x) という名前であるとします*1。 普通に書く a = arr.select { |e| foo?(e) } b = arr.select { |e| !foo?(e) } 排他的に分けたいのにブロックが2回書かれている。 条件に変更があった場合の変更漏れ、うっかり ! つけ忘れるなどのミスをやりそう。微妙。 selectとrejectする a = arr…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhkdnet.hatenablog.com%2Fentry%2F2017%2F01%2F21%2F005707&quot; title=&quot;RubyでEnumerableを条件Xを満たすものと満たさないものに排他的に分けたいんだけど - Smoky God Express&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>2017-01-21 00:57:07</published>
  <title>RubyでEnumerableを条件Xを満たすものと満たさないものに排他的に分けたいんだけど</title>
  <type>rich</type>
  <url>https://hkdnet.hatenablog.com/entry/2017/01/21/005707</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
