{"id":1782,"date":"2013-01-22T17:49:45","date_gmt":"2013-01-22T08:49:45","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=1782"},"modified":"2018-11-14T16:33:57","modified_gmt":"2018-11-14T07:33:57","slug":"ruby2-0%e3%81%aemodule-prepend%e3%81%af%e5%a6%82%e4%bd%95%e3%81%ab%e3%81%97%e3%81%a6alias_method_chain%e3%82%92%e6%92%b2%e6%bb%85%e3%81%99%e3%82%8b%e3%81%ae%e3%81%8b%ef%bc%81%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2013\/01\/22\/ruby2-0%e3%81%aemodule-prepend%e3%81%af%e5%a6%82%e4%bd%95%e3%81%ab%e3%81%97%e3%81%a6alias_method_chain%e3%82%92%e6%92%b2%e6%bb%85%e3%81%99%e3%82%8b%e3%81%ae%e3%81%8b%ef%bc%81%ef%bc%9f\/","title":{"rendered":"Ruby2.0\u306eModule#prepend\u306f\u5982\u4f55\u306b\u3057\u3066alias_method_chain\u3092\u64b2\u6ec5\u3059\u308b\u306e\u304b\uff01\uff1f"},"content":{"rendered":"<p>\u304a\u4e45\u3057\u3076\u308a\u3067\u3059\u3002\u5bfa\u5ca1\u3067\u3059\u3002<br \/>\n<a title=\"ruby2.0-preview2\u3067\u6020\u60f0\u306a\u751f\u6d3b\u3092\u9001\u3063\u3066\u307f\u305f\u30021.9\u7248lazy\u3082\u3042\u308b\u3088\uff01\uff01\" href=\"http:\/\/www.techscore.com\/blog\/2012\/12\/05\/ruby2-0-preview2%e3%81%a7%e6%80%a0%e6%83%b0%e3%81%aa%e7%94%9f%e6%b4%bb%e3%82%92%e9%80%81%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f\/\">lazy\u306b\u3064\u3044\u3066\u66f8\u3044\u305f\u524d\u56de<\/a>\u306b\u7d9a\u3044\u3066\u3001Ruby2.0\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u6ce8\u76ee\u3059\u308b\u65b0\u6a5f\u80fd\u306f\u3001Module#prepend\u3067\u3059\u3002<br \/>\nModule#prepend\u306fRuby2.0\u3067\u65b0\u305f\u306b\u8ffd\u52a0\u3055\u308c\u305f\u3001Module#include\u306e\u89aa\u621a\u306e\u3088\u3046\u306a\u6a5f\u80fd\u3067\u3059\u3002<br \/>\n\u4e00\u8a00\u3067\u8868\u3059\u3068\u300c\u30af\u30e9\u30b9\u306e\u7d99\u627f\u968e\u5c64\u306e\u624b\u524d\u306b\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u8ffd\u52a0\u3059\u308b\u300d\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nActiveSupport\u306eMudule#alias_method_chain\u3092\u4f7f\u308f\u305a\u306b\u7dba\u9e97\u306a\u30e2\u30f3\u30ad\u30fc\u30d1\u30c3\u30c1\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3001Module#prepend\u306e\u6319\u52d5\u3092\u63a2\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>ruby2.0-rc1\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>\u307e\u305a\u306f\u5b9f\u884c\u74b0\u5883\u306e\u6e96\u5099\u3067\u3059\u3002<br \/>\n\u524d\u56de\u306e\u8a18\u4e8b\u3067\u306fruby2.0-preview2\u3092\u4f7f\u3044\u307e\u3057\u305f\u304c\u3001\u6298\u89d2\u306a\u306e\u3067ruby2.0-rc1\u306b\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true\">$ rvm get head\r\n$ rvm get latest\r\n$ rvm list known | grep '\\[ruby-\\]'\r\n[ruby-]1.8.6[-p420]\r\n[ruby-]1.8.7[-p371]\r\n[ruby-]1.9.1[-p431]\r\n[ruby-]1.9.2[-p320]\r\n[ruby-]1.9.3-p125\r\n[ruby-]1.9.3-p194\r\n[ruby-]1.9.3-p286\r\n[ruby-]1.9.3-[p327]\r\n[ruby-]1.9.3-head\r\n[ruby-]2.0.0-rc1\r\n$ rvm install 2.0.0-rc1\r\n$ rvm use ruby-2.0.0-rc1\r\n$ ruby -v\r\nruby 2.0.0dev (2013-01-07 trunk 38733) [x86_64-linux]<\/pre>\n<h2>alias_method_chain\u3063\u3066\u306a\u3093\u3060\u3063\u3051\uff1f<\/h2>\n<p>Module#prepend\u3092\u8a66\u3059\u524d\u306b\u3001alias_method_chain\u304c\u3069\u3093\u306a\u6a5f\u80fd\u304b\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\nalias_method_chain\u306fActiveSupport\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3001\u30d1\u30c3\u30c1\u3092\u5f53\u3066\u308b\u969b\u306a\u3069\u306b\u3088\u304f\u5229\u7528\u3055\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u4ee5\u4e0b\u306eHoge\u30af\u30e9\u30b9\u306ehello\u30e1\u30bd\u30c3\u30c9\u3092\u3001taro\u541b\u5411\u3051\u306b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\"># hoge.rb\r\nclass Hoge\r\n  def hello\r\n    \"hello\"\r\n  end\r\nend<\/pre>\n<h4>\u30aa\u30fc\u30d7\u30f3\u30af\u30e9\u30b9\u3067\u518d\u5b9a\u7fa9<\/h4>\n<p>Ruby\u306b\u306f\u300c\u30e1\u30bd\u30c3\u30c9\u306e\u52d5\u7684\u306a\u5b9a\u7fa9\u3001\u66f8\u304d\u63db\u3048\u304c\u53ef\u80fd\u300d\u3068\u3044\u3046\u5927\u304d\u306a\u7279\u5fb4\u304c\u3042\u308b\u305f\u3081\u3001\u30aa\u30fc\u30d7\u30f3\u30af\u30e9\u30b9\u3092\u5229\u7528\u3057\u3066\u30e1\u30bd\u30c3\u30c9\u3092\u4e0a\u66f8\u304d\u3059\u308b\u3053\u3068\u3067\u3001\u30e1\u30bd\u30c3\u30c9\u306e\u6319\u52d5\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">load 'hoge.rb'\r\n# \u30aa\u30fc\u30d7\u30f3\u30af\u30e9\u30b9\u3067\u5143\u306e\u30e1\u30bd\u30c3\u30c9\u3092taro\u541b\u5411\u3051\u306b\u66f8\u304d\u63db\u3048\u308b\r\nclass Hoge\r\n  def hello\r\n    \"hello taro!\"\r\n  end\r\nend\r\n\r\nputs Hoge.new.hello # \u300chello taro!\u300d \u3068\u51fa\u529b\u3055\u308c\u308b<\/pre>\n<p>\u30e1\u30bd\u30c3\u30c9\u3092\u4e0a\u66f8\u304d\u3059\u308b\u3053\u3068\u3067\u3001\u671b\u307f\u3069\u304a\u308a\u306e\u7d50\u679c\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n\u3053\u306e\u4f8b\u3067\u306f\u3001\u65e2\u5b58\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5b8c\u5168\u306b\u7f6e\u304d\u63db\u3048\u3066\u3057\u307e\u3063\u3066\u3044\u308b\u305f\u3081\u3001hello\u30e1\u30bd\u30c3\u30c9\u306e\u51fa\u529b\u304c\u300cHello!\u300d\u306b\u5909\u66f4\u3055\u308c\u305f\u5834\u5408\u306a\u3069\u3001\u5143\u3005\u306ehello\u30e1\u30bd\u30c3\u30c9\u306e\u5909\u66f4\u306b\u8ffd\u5f93\u3067\u304d\u306a\u3044\u6b20\u70b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h4>alias\u3067\u5225\u540d\u3092\u3064\u3051\u308b<\/h4>\n<p>\u305d\u3053\u3067\u3001\u30e1\u30bd\u30c3\u30c9\u306e\u5225\u540d\u3092\u3064\u3051\u308balias\u3092\u5229\u7528\u3057\u3066\u5143\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5225\u540d\u3067\u9000\u907f\u3055\u305b\u3001\u66f8\u304d\u63db\u3048\u305f\u30e1\u30bd\u30c3\u30c9\u304b\u3089\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u3059\u308b\u30c6\u30af\u30cb\u30c3\u30af\u304c\u751f\u307e\u308c\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">load 'hoge.rb'\r\n# \u5143\u3005\u306ehello\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3064\u3064taro\u541b\u5411\u3051\u306b\u66f8\u304d\u63db\u3048\u305f\u3044\uff01\r\nclass Hoge\r\n  def hello_with_taro\r\n    hello_without_taro + \" taro!\"\r\n  end\r\n  alias hello_without_taro hello\r\n  alias hello hello_with_taro\r\nend\r\n\r\nputs Hoge.new.hello # \u300chello taro!\u300d \u3068\u51fa\u529b\u3055\u308c\u308b<\/pre>\n<h4>alias_method_chain\u3067DRY\u306b\uff01<\/h4>\n<p>\u4e0a\u306e\u4f8b\u306e2\u884c\u306ealias\u547c\u3073\u51fa\u3057\u3092\u7c21\u7565\u5316\u3057\u3066\u304f\u308c\u308b\u306e\u304calias_method_chain\u3067\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">load 'hoge.rb'\r\n# alias_method_chain\u3067hello\u30e1\u30bd\u30c3\u30c9\u3092taro\u541b\u5411\u3051\u306b\u66f8\u304d\u63db\u3048\u305f\u3044\uff01\r\nclass Hoge\r\n  def hello_with_taro\r\n    hello_without_taro + \" taro!\"\r\n  end\r\n  alias_method_chain :hello, :taro\r\nend\r\n\r\nputs Hoge.new.hello # \u300chello taro!\u300d \u3068\u51fa\u529b\u3055\u308c\u308b<\/pre>\n<p>\u3053\u306ealias_method_chain\u306fRails\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e2d\u306e\u81f3\u308b\u6240\u3067\u5229\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3057\u304b\u3057\u3001\u30e1\u30bd\u30c3\u30c9\u3092\u5225\u540d\u3067\u9000\u907f\u3055\u305b\u3066\u547c\u3073\u51fa\u3059\u3053\u306e\u30c6\u30af\u30cb\u30c3\u30af\u306f\u3042\u307e\u308a\u7dba\u9e97\u306a\u624b\u6bb5\u3068\u306f\u8a00\u3048\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<h2>prepend\u306e\u767b\u5834\uff01<\/h2>\n<p>\u305d\u3053\u3067\u6e80\u3092\u6301\u3057\u3066\u767b\u5834\u3057\u305f\u306e\u304cMudule.prepend\u3067\u3059\u3002<br \/>\n\u65e9\u901f\u4e0a\u8a18\u306ehello\u30e1\u30bd\u30c3\u30c9\u3092\u7f6e\u304d\u63db\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">load 'hoge.rb'\r\n# Mudule.prepend\u5229\u7528\u3057\u3066taro\u541b\u5411\u3051\u306b\u66f8\u304d\u63db\u3048\u305f\u3044\uff01\r\nmodule TarosHello\r\n  def hello\r\n    super + \" taro!\"\r\n  end\r\nend\r\n\r\nclass Hoge\r\n  prepend TarosHello\r\nend\r\n\r\nputs Hoge.new.hello # \u300chello taro!\u300d \u3068\u51fa\u529b\u3055\u308c\u308b<\/pre>\n<p>\u898b\u4e8b\u306b\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n\u30e2\u30b8\u30e5\u30fc\u30eb\u3092prepend\u3067\u3059\u308b\u3053\u3068\u3067\u3001TarosHello#hello\u306e\u4e2d\u304b\u3089super\uff08Hoge#hello\uff09\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u51fa\u6765\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>include\u306e\u4ed5\u7d44\u307f<\/h2>\n<p>\u8a66\u3057\u306b\u3001\u5148\u307b\u3069\u306e\u4f8b\u306eprepend\u3092include\u306b\u5909\u66f4\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"lang:ruby decode:true\">load 'hoge.rb'\r\n# Mudule.include\u5229\u7528\u3057\u3066taro\u541b\u5411\u3051\u306b\u66f8\u304d\u63db\u3048\u3089\u308c\u306a\u3044\u2026\u2026\r\nmodule TarosHello\r\n  def hello\r\n    super + \" taro!\"\r\n  end\r\nend\r\n\r\nclass Hoge\r\n  include TarosHello\r\nend\r\n\r\nputs Hoge.new.hello # \u300chello\u300d \u3068\u51fa\u529b\u3055\u308c\u308b<\/pre>\n<p>Hoge\u30af\u30e9\u30b9\u306e\u5143\u3005\u306ehello\u30e1\u30bd\u30c3\u30c9\u304c\u5b9f\u884c\u3055\u308c\u3001TarosHello\u30e2\u30b8\u30e5\u30fc\u30eb\u306ehello\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br \/>\n\u3067\u306f\u3001\u3053\u306e\u9055\u3044\u306f\u3069\u3053\u304b\u3089\u6765\u308b\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<h4>include\u306e\u304a\u3055\u3089\u3044<\/h4>\n<p>include\u3068prepend\u306e\u9055\u3044\u3092\u7406\u89e3\u3059\u308b\u305f\u3081\u306b\u3001include\u306e\u6319\u52d5\u3092\u304a\u3055\u3089\u3044\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>include\u3068\u306f\u3001\u30af\u30e9\u30b9\u306e\u7d99\u627f\u95a2\u4fc2\u306e\u9593\u306b\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u8ffd\u52a0\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<br \/>\ninclude\u3055\u308c\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001\u5bfe\u8c61\u30af\u30e9\u30b9\u3068\u89aa\u30af\u30e9\u30b9\u306e\u9593\u306b\u8ffd\u52a0\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>Mudule\u3092include\u3057\u305f\u969b\u306e\u7d99\u627f\u95a2\u4fc2\u306e\u4f8b<\/h3>\n<pre class=\"lang:ruby decode:true\">module ModuleX\r\n  def hoge\r\n    \"ModuleX\"\r\n  end\r\nend\r\n\r\nmodule ModuleY\r\n  def hoge\r\n    \"ModuleY,\" + super\r\n  end\r\nend\r\n\r\nmodule ModuleZ\r\n  include ModuleY\r\n\r\n  def hoge\r\n    \"ModuleZ,\" + super\r\n  end\r\nend\r\n\r\nclass MyClassA\r\n  include ModuleX\r\n  include ModuleZ\r\n\r\n  def hoge\r\n    \"MyClassA,\" + super\r\n  end\r\nend\r\n\r\nMyClassA.new.hoge  # \"MyClassA,ModuleZ,ModuleY,ModuleX\"\r\nMyClassA.ancestors # [MyClassA, ModuleZ, ModuleY, ModuleX, Object, Kernel, BasicObject]<\/pre>\n<p>ancestors\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u7d99\u627f\u95a2\u4fc2\u3092\u914d\u5217\u3067\u8fd4\u3057\u3066\u304f\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<br \/>\nMyClassA.new.hoge\u30e1\u30bd\u30c3\u30c9\u306e\u7d50\u679c\u3068\u898b\u6bd4\u3079\u3066\u308f\u304b\u308b\u3088\u3046\u306b\u3001\u5b9f\u884c\u6642\u306b\u306f\u3053\u306e\u9806\u756a\u3067\u30e1\u30bd\u30c3\u30c9\u306e\u63a2\u7d22\u304c\u884c\u308f\u308c\u307e\u3059\u3002<br \/>\n\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3055\u308c\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001\u81ea\u8eab\u306e\u30af\u30e9\u30b9\u7d99\u627f\u95a2\u4fc2\u306e\u4e00\u3064\u4e0a\u306b\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002<br \/>\n\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5229\u7528\u3057\u3066\u306emix-in\u306f\u591a\u91cd\u7d99\u627f\u306e\u3088\u3046\u306b\u632f\u821e\u3044\u307e\u3059\u304c\u3001\u5b9f\u969b\u306b\u306f\u5358\u4e00\u7d99\u627f\u3068\u540c\u3058\u3088\u3046\u306b\u7dda\u5f62\u306e\u7d99\u627f\u30eb\u30fc\u30eb\u3092\u6301\u3063\u3066\u3044\u308b\u306e\u3067\u3059\u3002<\/p>\n<h3>MyClassA\u306e\u7d99\u627f\u95a2\u4fc2\u306e\u56f3(include)<\/h3>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/01\/include.png\" rel=\"facebox\" rel=\"attachment wp-att-1784\"><img class=\"alignnone wp-image-1784\" alt=\"module\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/01\/include.png\" width=\"450\" \/><\/a><\/p>\n<h2>prepend\u306b\u8feb\u308b\uff01<\/h2>\n<p>\u3067\u306f\u672c\u984c\u306eModule#prepend\u306b\u8feb\u3063\u3066\u884c\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4e0b\u306e\u4f8b\u3067\u306finclude\u306e\u4f8b\u306b\u3042\u3063\u305fModuleZ\u3092prepend\u3059\u308b\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<h3>Mudule\u3092prepend\u3057\u305f\u969b\u306e\u7d99\u627f\u95a2\u4fc2\u306e\u4f8b<\/h3>\n<pre class=\"lang:ruby decode:true\">module ModuleX\r\n  def hoge\r\n    \"ModuleX\"\r\n  end\r\nend\r\n\r\nmodule ModuleY\r\n  def hoge\r\n    \"ModuleY,\" + super\r\n  end\r\nend\r\n\r\nmodule ModuleZ\r\n  include ModuleY\r\n\r\n  def hoge\r\n    \"ModuleZ,\" + super\r\n  end\r\nend\r\n\r\nclass MyClassA\r\n  include ModuleX\r\n  prepend ModuleZ\r\n\r\n  def hoge\r\n    \"MyClassA,\" + super\r\n  end\r\nend\r\n\r\nMyClassA.new.hoge  # \"ModuleZ,ModuleY,MyClassA,ModuleX\"\r\nMyClassA.ancestors # [ModuleZ, ModuleY, MyClassA, ModuleX, Object, Kernel, BasicObject]<\/pre>\n<p>prepend\u3055\u308c\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u7d99\u627f\u95a2\u4fc2\u4e0a\u3001\u5bfe\u8c61\u306e\u30af\u30e9\u30b9\u3088\u308a\u624b\u524d\u306b\u4f4d\u7f6e\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<br \/>\n\u3053\u306e\u305f\u3081\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30e1\u30bd\u30c3\u30c9\u304b\u3089super\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u3067\u5143\u3005\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u308f\u3051\u3067\u3059\u3002<\/p>\n<h3>MyClassA\u306e\u7d99\u627f\u95a2\u4fc2\u306e\u56f3(prepend)<\/h3>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/01\/prepend.png\" rel=\"facebox\" rel=\"attachment wp-att-1785\"><img class=\"alignnone wp-image-1785\" alt=\"prepend\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/01\/prepend.png\" width=\"450\" \/><\/a><\/p>\n<h2>include\u3068prepend\u306e\u4f7f\u3044\u308f\u3051<\/h2>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/01\/include.png\" rel=\"facebox\" rel=\"attachment wp-att-1784\"><img class=\"alignnone wp-image-1784\" alt=\"module\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/01\/include.png\" width=\"350\" \/><\/a><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/01\/prepend.png\" rel=\"facebox\" rel=\"attachment wp-att-1785\"><img class=\"alignnone wp-image-1785\" alt=\"prepend\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/01\/prepend.png\" width=\"350\" \/><\/a><\/p>\n<p>include\u3068prepend\u306e\u7d99\u627f\u95a2\u4fc2\u306e\u56f3\u3092\u6bd4\u3079\u3066\u307f\u308b\u3068\u3001include\u306f\u30af\u30e9\u30b9\u306e\u5965\u306b\u3001prepend\u306f\u30af\u30e9\u30b9\u306e\u624b\u524d\u306b\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u308f\u304b\u308a\u307e\u3059\u3002<br \/>\n\u3053\u306e\u305f\u3081\u3001prepend\u3055\u308c\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u5b9a\u7fa9\u3055\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u5bfe\u8c61\u306e\u30af\u30e9\u30b9\uff08\u3053\u306e\u5834\u5408\u306fMyClassA\uff09\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u3088\u308a\u512a\u5148\u3055\u308c\u307e\u3059\u3002<br \/>\ninclude\u3068prepend\u3067\u306f\u7d99\u627f\u95a2\u4fc2\u306e\u633f\u5165\u4f4d\u7f6e\u306e\u9055\u3044\u306b\u3088\u3063\u3066\u3001\u4ee5\u4e0b\u306e\u7279\u5fb4\u3092\u6301\u3061\u307e\u3059\u3002<\/p>\n<h3>include<\/h3>\n<ul>\n<li>\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u5b9a\u7fa9\u3057\u305f\u30e1\u30bd\u30c3\u30c9\u3067\u30af\u30e9\u30b9\u306b\u5b58\u5728\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306e\u4e0a\u66f8\u304d\u306f\u3067\u304d\u306a\u3044<\/li>\n<li>\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u3088\u3063\u3066\u8ffd\u52a0\u3055\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u30af\u30e9\u30b9\u5074\u3067\u4e0a\u66f8\u304d\u3067\u304d\u308b<\/li>\n<\/ul>\n<h3>prepend<\/h3>\n<ul>\n<li>\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u5b9a\u7fa9\u3057\u305f\u30e1\u30bd\u30c3\u30c9\u3067\u30af\u30e9\u30b9\u306b\u5b58\u5728\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u4e0a\u66f8\u304d\u3067\u304d\u308b<\/li>\n<li>\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u3088\u3063\u3066\u8ffd\u52a0\u3055\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u306f\u30af\u30e9\u30b9\u5074\u3067\u306f\u4e0a\u66f8\u304d\u3067\u304d\u306a\u3044<\/li>\n<\/ul>\n<p>\u3053\u308c\u3089\u306e\u7279\u5fb4\u304b\u3089include\u3068prepend\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4f7f\u3044\u5206\u3051\u308c\u3070\u826f\u3044\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<br \/>\n<strong>include\u306f\u30af\u30e9\u30b9\u306b\u5bfe\u3057\u3066\u65b0\u305f\u306a\u6a5f\u80fd\u3092\u63d0\u4f9b\u3059\u308b\u5834\u5408\u306b\u5229\u7528\u3059\u308b\u3002<\/strong><br \/>\n<strong>prepend\u306f\u30af\u30e9\u30b9\u306b\u65e2\u306b\u5b58\u5728\u3059\u308b\u6a5f\u80fd\u3092\u5909\u66f4\u3059\u308b\u305f\u3081\u306b\u5229\u7528\u3059\u308b\u3002<\/strong><\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u306fprepend\u306b\u3064\u3044\u3066\u8ffd\u3044\u304b\u3051\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u6539\u3081\u3066\u9055\u3044\u3092\u6bd4\u3079\u3066\u307f\u305f\u3089\u3001\u660e\u78ba\u306a\u4f7f\u3044\u5206\u3051\u304c\u898b\u3048\u3066\u304d\u3066\u9762\u767d\u304b\u3063\u305f\u3067\u3059\u3002<br \/>\n\u6b21\u56de\u306fRefinements\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u307f\u3088\u3046\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u304a\u4e45\u3057\u3076\u308a\u3067\u3059\u3002\u5bfa\u5ca1\u3067\u3059\u3002<br \/>\nlazy\u306b\u3064\u3044\u3066\u66f8\u3044\u305f\u524d\u56de\u306b\u7d9a\u3044\u3066\u3001Ruby2.0\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u6ce8\u76ee\u3059\u308b\u65b0\u6a5f\u80fd\u306f\u3001Module#prepend\u3067\u3059\u3002<br \/><a href=\"https:\/\/www.techscore.com\/blog\/2013\/01\/22\/ruby2-0%e3%81%aemodule-prepend%e3%81%af%e5%a6%82%e4%bd%95%e3%81%ab%e3%81%97%e3%81%a6alias_method_chain%e3%82%92%e6%92%b2%e6%bb%85%e3%81%99%e3%82%8b%e3%81%ae%e3%81%8b%ef%bc%81%ef%bc%9f\/\">\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[24],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/1782"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=1782"}],"version-history":[{"count":1,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/1782\/revisions"}],"predecessor-version":[{"id":17972,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/1782\/revisions\/17972"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=1782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=1782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=1782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}