<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>rubikitch</author_name>
  <author_url>https://blog.hatena.ne.jp/rubikitch/</author_url>
  <blog_title>http://rubikitch.com/に移転しました</blog_title>
  <blog_url>https://rubikitch.hatenadiary.org/</blog_url>
  <categories>
    <anon>ruby</anon>
  </categories>
  <description>僅か30分で3つのバグ - Rubyの落し穴 - — ありえるえりあ arr = [] arr.push({:x=&gt;1,:y=&gt;1}).push({:x=&gt;2,:y=&gt;2}).push({:x=&gt;1,:y=&gt;9}).push({:x=&gt;5,:y=&gt;0}).push({:x=&gt;1,:y=&gt;3}) x要素がプライマリなソートキーで、y要素がセカンダリなソートキーだとして、次のようにソ ート処理を書きました。 sort_byならもっと簡単に書ける。 def sort1(arr) arr.sort do |a,b| next 1 if !a[:x] next -1 if !b[:x] cmp = a[…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Frubikitch.hatenadiary.org%2Fentry%2F20080419%2F1208547628&quot; title=&quot;sort_by使おうよ - http://rubikitch.com/に移転しました&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>2008-04-19 04:40:28</published>
  <title>sort_by使おうよ</title>
  <type>rich</type>
  <url>https://rubikitch.hatenadiary.org/entry/20080419/1208547628</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
