{"url":"https://babie.hatenablog.com/entry/20060215/p4","blog_url":"https://babie.hatenablog.com/","published":"2006-02-15 00:00:03","height":"190","title":" \u30cf\u30c3\u30b7\u30e5\u306e\u30bd\u30fc\u30c8","version":"1.0","provider_url":"https://hatena.blog","blog_title":"babie, you're my home","width":"100%","type":"rich","description":"Hash#sort (\u5b9f\u969b\u306f Enumerable)\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067 \"ORDER BY key\" \u3060\u3068\u5b09\u3057\u3044\u3002\u3088\u304f\u3084\u308b\u64cd\u4f5c\u3060\u304b\u3089\u3002 #!/usr/bin/ruby class Symbol def <=> b self.to_s <=> b.to_s end end class Hash alias :default_sort :sort def sort &b unless b.nil? self.default_sort &b else self.to_a.sort { |a,b| a[0] <=> b[0] } end end end h = { :e => 1, :d => 2, :\u2026","provider_name":"Hatena Blog","author_name":"babie","author_url":"https://blog.hatena.ne.jp/babie/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fbabie.hatenablog.com%2Fentry%2F20060215%2Fp4\" title=\" \u30cf\u30c3\u30b7\u30e5\u306e\u30bd\u30fc\u30c8 - babie, you&#39;re my home\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","categories":["ruby","memo"],"image_url":null}