<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>obelisk2</author_name>
  <author_url>https://blog.hatena.ne.jp/obelisk2/</author_url>
  <blog_title>Camera Obscura</blog_title>
  <blog_url>https://obelisk.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>新人プログラマに知ってもらいたいメソッドを読みやすく維持するいくつかの原則 - Qiita を見ていたら、クロージャを使っておもしろい仕方でカウンターが作れることを知った。元のコードは JavaScript のようであるが、Ruby だとこんな感じ。 $ pry [1] pry(main)&gt; counter = -&gt;{ [1] pry(main)* count = 0 [1] pry(main)* -&gt;{count += 1} [1] pry(main)* }.call =&gt; #&lt;Proc:0x005594b3626450@(pry):3 (lambda)&gt; [2] pry(main)&gt; co…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fobelisk.hatenablog.com%2Fentry%2F2018%2F04%2F20%2F162133&quot; title=&quot;クロージャを使ったカウンター - Camera Obscura&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>2018-04-20 16:21:33</published>
  <title>クロージャを使ったカウンター</title>
  <type>rich</type>
  <url>https://obelisk.hatenablog.com/entry/2018/04/20/162133</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
