<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>bawsin</author_name>
  <author_url>https://blog.hatena.ne.jp/bawsin/</author_url>
  <blog_title>Rubyの輝き</blog_title>
  <blog_url>https://bawsin.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>Rubyは、「ブロック構文」という機能を標準で備えています。これを使うと、AOPに類似した機能を実現できます。 実際に例を見てみましょう。 まず、「yield」というキーワードを記述したメソッドを定義します。 def testblock puts &quot;begin operation&quot;; yield puts &quot;end operation&quot;; end 「yield」の前後で文字列を出力するだけのメソッドです。 次に、上記で定義したメソッドを利用するコードを記述します。 testblock { puts &quot;method execution!&quot;; } 実行結果は以下のようになります。 begin op…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fbawsin.hatenablog.com%2Fentry%2F20070219%2F1171905815&quot; title=&quot;Rubyのブロック構文 - Rubyの輝き&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>2007-02-19 02:23:35</published>
  <title>Rubyのブロック構文</title>
  <type>rich</type>
  <url>https://bawsin.hatenablog.com/entry/20070219/1171905815</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
