{"published":"2006-02-28 00:00:08","author_name":"rubyco","categories":[],"version":"1.0","author_url":"https://blog.hatena.ne.jp/rubyco/","height":"190","width":"100%","provider_url":"https://hatena.blog","blog_title":"rubyco\uff08\u308b\u3073\u3053\uff09\u306e\u65e5\u8a18","description":"Ruby\u306e\u30e1\u30bd\u30c3\u30c9\u306e\u4e2d\u3067\u3001\u30d6\u30ed\u30c3\u30af\uff08\u30a4\u30c6\u30ec\u30fc\u30bf\uff09\u304c\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u8abf\u3079\u308b\u3068\u304d\u306b\u306fblock_given?\u304c\u4f7f\u3048\u307e\u3059\u3002 def my_each(*arg) if block_given? arg.each do |a| yield(a) end else arg end end my_each(1,2,3) do |f| p f end p my_each(1,2,3) #=> [1, 2, 3]","blog_url":"https://rubyco.hatenadiary.org/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Frubyco.hatenadiary.org%2Fentry%2F20060228%2Fblockgiven\" title=\"block_given? - rubyco\uff08\u308b\u3073\u3053\uff09\u306e\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","image_url":null,"provider_name":"Hatena Blog","title":"block_given?","url":"https://rubyco.hatenadiary.org/entry/20060228/blockgiven","type":"rich"}