{"id":1456,"date":"2006-08-14T19:40:40","date_gmt":"2006-08-14T11:40:40","guid":{"rendered":"http:\/\/ihower.idv.tw\/blog\/archives\/1456"},"modified":"2007-02-11T22:11:39","modified_gmt":"2007-02-11T14:11:39","slug":"%e8%bd%89%e8%bc%89-closure-%e6%96%87%e7%ab%a0","status":"publish","type":"post","link":"https:\/\/ihower.tw\/blog\/1456-%e8%bd%89%e8%bc%89-closure-%e6%96%87%e7%ab%a0","title":{"rendered":"[\u8f49\u8f09] Closure \u7ffb\u8b6f\u6587\u7ae0"},"content":{"rendered":"<p>\u56e0\u70ba\u6211\u9023\u4e0d\u5230\u539f\u4e2d\u6587\u7ffb\u8b6f\u7684\u7db2\u5740\u4e86\uff0c\u6240\u4ee5\u53ea\u597d\u628a\u627e\u5230\u7684\u6587\u7ae0\u8f49\u8cbc\u904e\u4f86\u3002Closure \u548c Block \u662f Ruby \u4e2d\u5f88\u91cd\u8981\u7684\u7279\u8272\uff0c\u800c Martin Fowler \u7684\u9019\u7bc7\u5247\u7528 Ruby \u4f86\u8209\u4f8b\u89e3\u91cb Closure\u3002<\/p>\n<p>Ruby\u63d0\u4f9b\u4e86\u597d\u7528\u7684 syntax \u8ddf invocation \u4f86\u652f\u63f4 closure\u3002\u662f\u7684\uff0c<strong><a href=\"http:\/\/www.rubyist.net\/~matz\/slides\/oscon2005\/mgp00001.html\">Syntax matters<\/a><\/strong>\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u539f\u8457\uff1aMartin Fowler <a href=\"http:\/\/martinfowler.com\/bliki\/Closures.html\">martinfowler.com\/bliki\/Closures.html<\/a><\/p>\n<p>\u7ffb\u8b6f\uff1aliubin (at) <a href=\"http:\/\/huangpuzhuang.com\" class=\"autohyperlink\">huangpuzhuang.com<\/a><\/p>\n<p>\u53e6\u5916\u4e00\u7247\u6587\u7ae0\u7e3d\u7d50\u4e86\u5404\u7a2e\u8a9e\u8a00\u5be6\u73fe\u7684\u672c\u6587\u4e2d\u7684\u4f8b\u5b50\u3002<a href=\"http:\/\/blog.csdn.net\/ruby_cn\/archive\/2004\/11\/23\/192588.aspx\">\u9589\u5305\uff08Closures\uff09\u5728\u5404\u7a2e\u8a9e\u8a00\u4e2d\u7684\u4f8b\u5b50<\/a><\/p>\n<p>2004\/11\/23<\/p>\n<p>\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.ruby-cn.org\/articles\/closures.html\">www.ruby-cn.org\/articles\/closures.html<\/a><\/p>\n<p>\u96a8\u8457\u4eba\u5011\u5c0d\u52d5\u614b\u8a9e\u8a00\u8208\u8da3\u7684\u65e5\u76ca\u6fc3\u539a\uff0c\u8d8a\u4f86\u8d8a\u591a\u7684\u4eba\u90fd\u9047\u5230\u4e86\u9589\u5305\uff08Closures \uff09\u548c\u6216\u584a\uff08Blocks\uff09\u7b49\u6982\u5ff5\u3002\u6709\u8457C\/C++\/Java\/C#\u7b49\u8a9e\u8a00\u80cc\u666f\u7684\u4eba\u56e0\u70ba\u9019\u4e9b\u8a9e\u8a00\u672c\u8eab\u6c92\u6709\u9589\u5305\u9019\u500b\u6982\u5ff5\uff0c\u6240\u4ee5\u53ef\u80fd\u4e0d\u592a\u4e86\u89e3\u9589\u5305\u3002\u672c\u6587\u5c07\u7c21\u55ae\u7684\u4ecb\u7d39\u4e00\u4e0b\u9589\u5305\u7684\u6982\u5ff5\uff0c\u90a3\u4e9b\u6709\u5927\u91cf\u652f\u6301\u9589\u5305\u8a9e\u8a00\u7de8\u7a0b\u7d93\u9a57\u7684\u4eba\u4e5f\u8a31\u89ba\u5f97\u672c\u6587\u4e0d\u6703\u592a\u6709\u610f\u601d\u3002\u9589\u5305\u7684\u6982\u5ff5\u5df2\u7d93\u63d0\u51fa\u5f88\u9577\u6642\u9593\u4e86\u3002\u6211\u7b2c\u4e00\u6b21\u78b0\u5230\u9019\u5b83\u662f\u5728smalltalk\u4e2d\uff0c\u90a3\u6642\u5019\u9084\u53eb\u505a\u584a\uff08blocks\uff09\u3002Lisp\u8a9e\u8a00\u4e2d\u7528\u7684\u5f88\u591a\u3002Ruby\u4e2d\u4e5f\u6709\u540c\u6a23\u7684\u529f\u80fd\uff0d\u9019\u4e5f\u662fRuby\u7528\u6236\u559c\u6b61Ruby\u7684\u4e00\u500b\u539f\u56e0\u3002<\/p>\n<p>\u672c\u8cea\u4e0a\u4f86\u8aaa\uff0c\u4e00\u500b\u9589\u5305\u662f\u4e00\u584a\u4ee3\u78bc\uff0c\u5b83\u5011\u80fd\u4f5c\u70ba\u53c3\u6578\u50b3\u905e\u7d66\u4e00\u500b\u65b9\u6cd5\u8abf\u7528\u3002\u6211\u5c07\u901a\u904e\u4e00\u500b\u7c21\u55ae\u7684\u4f8b\u5b50\u4f86\u95e1\u8ff0\u9019\u500b\u89c0\u9ede\u3002\u5047\u8a2d\u6211\u5011\u6709\u4e00\u500b\u5305\u542b\u4e00\u4e9b\u96c7\u54e1\u5c0d\u8c61\u7684\u5217\u8868\uff0c\u7136\u5f8c\u6211\u60f3\u5217\u51fa\u8077\u4f4d\u70ba\u7d93\u7406\u7684\u54e1\u5de5\uff0c\u9019\u6a23\u7684\u54e1\u5de5\u53ef\u4ee5\u901a\u904eIsManager\u5224\u65b7\u3002\u5728C#\u88e1\uff0c\u6211\u5011\u53ef\u80fd\u6703\u5beb\u51fa\u4e0b\u9eb5\u985e\u4f3c\u7684\u4ee3\u78bc\uff1a<\/p>\n<blockquote><p>public static IList Managers(IList emps) {<br \/>\n\u00a0 IList result = new ArrayList();<br \/>\n\u00a0 foreach(Employee e in emps)<br \/>\n\u00a0\u00a0 if (e.IsManager) result.Add(e);<br \/>\n\u00a0\u00a0\u00a0 return result;<br \/>\n}<\/p><\/blockquote>\n<p>\u5728\u4e00\u7a2e\u652f\u6301\u9589\u5305\u7684\u8a9e\u8a00\u4e2d\uff0c\u6bd4\u5982Ruby\uff0c\u6211\u5011\u53ef\u4ee5\u9019\u6a23\u5beb\uff1a<\/p>\n<blockquote><p>def managers(emps)<br \/>\n\u00a0 return emps.select {|e| e.isManager}<br \/>\nend<\/p><\/blockquote>\n<p>select\u662fRuby\u4e2d\u5b9a\u7fa9\u7684\u96c6\u5408\u7d50\u69cb\u4e2d\u7684\u4e00\u500b\u65b9\u6cd5\uff0c\u5b83\u63a5\u53d7\u4e00\u500bblock\uff0c\u4e5f\u5c31\u662f\u9589\u5305\uff0c\u4f5c\u70ba\u4e00\u500b\u53c3\u6578\u3002\u5728Ruby\u4e2d\uff0c\u9589\u5305\u5beb\u5728\u4e00\u5c0d\u5927\u62ec\u865f\u4e2d\uff08\u4e0d\u6b62\u9019\u4e00\u7a2e\u65b9\u6cd5\uff0c\u53e6\u4e00\u7a2e\u70bado .. end\uff09\u3002\u5982\u679c\u9019\u500b\u584a\u4e5f\u63a5\u53d7\u53c3\u6578\uff0c\u4f60\u53ef\u4ee5\u5c07\u9019\u4e9b\u53c3\u6578\u653e\u5230\u5169\u500b\u8c4e\u7dda\u4e4b\u9593\u3002select\u65b9\u6cd5\u5faa\u74b0\u8fed\u4ee3\u7d66\u5b9a\u7684\u6578\u7d44\uff0c\u5c0d\u6bcf\u500b\u5143\u7d20\u57f7\u884c\u7d66\u5b9a\u7684block\uff0c\u7136\u5f8c\u5c07\u6bcf\u6b21\u57f7\u884cblock\u8fd4\u56detrue\u7684\u5143\u7d20\u7d44\u6210\u4e00\u500b\u65b0\u7684\u6578\u7d44\u518d\u8fd4\u56de\u3002<\/p>\n<p>\u73fe\u5728\uff0c\u5982\u679c\u4f60\u662fC\u7a0b\u5e8f\u54e1\u4f60\u4e5f\u8a31\u8981\u60f3\uff0c\u901a\u904e\u51fd\u6578\u6307\u91dd\u4e5f\u53ef\u4ee5\u5be6\u73fe\uff0c\u5982\u679c\u4f60\u662fJAVA\u7a0b\u5e8f\u54e1\uff0c\u4f60\u53ef\u80fd\u56de\u60f3\u6211\u53ef\u4ee5\u7528\u533f\u540d\u5167\u985e\u4f86\u5be6\u73fe\uff0c\u800c\u4e00\u500bC#\u8005\u5247\u6703\u60f3\u5230\u4ee3\u7406\uff08delegate\uff09\u3002\u9019\u4e9b\u6a5f\u5236\u548c\u9589\u5305\u985e\u4f3c\uff0c\u4f46\u662f\u5b83\u5011\u548c\u9589\u5305\u4e4b\u9593\u6709\u5169\u500b\u660e\u986f\u5f97\u5340\u5225\u3002<\/p>\n<p>\u7b2c\u4e00\u500b\u662f\u5f62\u5f0f\u4e0a\u7684\u4e0d\u540c\uff08The first one is a formal difference\uff09\u3002\u9589\u5305\u53ef\u4ee5\u5f15\u7528\u5b83\u5b9a\u7fa9\u6642\u5019\u53ef\u898b\u7684\u8b8a\u91cf\u3002\u770b\u770b\u4e0b\u9762\u7684\u65b9\u6cd5\uff1a<\/p>\n<blockquote><p>def highPaid(emps)<br \/>\n\u00a0threshold = 150<br \/>\n\u00a0return emps.select {|e| e.salary &gt; threshold}<br \/>\nend<\/p><\/blockquote>\n<p>\u6ce8\u610fselect\u7684block\u4ee3\u78bc\u4e2d\u5f15\u7528\u4e86\u5728\u5305\u542b\u5b83\u7684\u65b9\u6cd5\u4e2d\u7684\u5c40\u90e8\u8b8a\u91cf\uff0c\u800c\u5176\u5b83\u4e0d\u652f\u6301\u771f\u6b63\u9589\u5305\u7684\u8a9e\u8a00\u4f7f\u7528\u5176\u5b83\u65b9\u6cd5\u9054\u5230\u985e\u4f3c\u529f\u80fd\u7684\u65b9\u6cd5\u5247\u4e0d\u80fd\u9019\u6a23\u505a\u3002\u9589\u5305\u9084\u5141\u8a31\u4f60\u505a\u66f4\u6709\u8da3\u7684\u4e8b\u60c5\uff0c\u6bd4\u5982\u4e0b\u9762\u65b9\u6cd5\uff1a<\/p>\n<blockquote><p>def paidMore(amount)<br \/>\n\u00a0return Proc.new {|e| e.salary &gt; amount}<br \/>\nend<\/p><\/blockquote>\n<p>\u9019\u500b\u65b9\u6cd5\u8fd4\u56de\u4e00\u500b\u9589\u5305\uff0c\u5be6\u969b\u4e0a\u5b83\u8fd4\u56de\u4e00\u500b\u4f9d\u8cf4\u65bc\u50b3\u7d66\u5b83\u7684\u53c3\u6578\u7684\u9589\u5305\u3002\u6211\u53ef\u4ee5\u7528\u4e00\u500b\u53c3\u6578\u5275\u5efa\u4e00\u500b\u9019\u6a23\u7684\u65b9\u6cd5\uff0c\u7136\u5f8c\u518d\u628a\u5b83\u8ce6\u7d66\u53e6\u4e00\u500b\u8b8a\u91cf\u3002<\/p>\n<blockquote><p>highPaid = paidMore(150)<\/p><\/blockquote>\n<p>\u8b8a\u91cf highPaid \u5305\u542b\u4e86\u4e00\u6bb5\u4ee3\u78bc\uff08\u5728Ruby\u4e2d\u662f\u4e00\u500bProc\u5c0d\u8c61\uff09\uff0c\u9019\u6bb5\u4ee3\u78bc\u5c07\u5224\u65b7\u4e00\u500b\u5c0d\u8c61\u7684salary\u5c6c\u6027\u662f\u5426\u5927\u65bc150\u3002\u6211\u5011\u53ef\u4ee5\u9019\u6a23\u4f7f\u7528\u9019\u500b\u65b9\u6cd5\uff1a<\/p>\n<blockquote><p>john = Employee.new<br \/>\njohn.salary = 200<br \/>\nprint highPaid.call(john)<\/p><\/blockquote>\n<p>\u8868\u9054\u5f0fhighPaid.call(john)\u8abf\u7528\u6211\u4e4b\u524d\u5b9a\u7fa9\u7684\u4ee3\u78bc\uff0c\u9019\u6642\u5019\u6b64\u4ee3\u78bc\u4e2d\u7684amount\u5df2\u7d93\u5728\u5275\u5efa\u9019\u65b9\u6cd5\u7684\u6642\u5019\u7d81\u5b9a\u70ba150\u3002\u5373\u4f7f\u73fe\u5728\u6211\u57f7\u884cprint \u7684\u6642\u5019\uff0c150\u5df2\u7d93\u4e0d\u5728\u5b83\u7684\u7bc4\u570d\u5167\u4e86\uff0c\u4f46\u662famount\u548c150\u4e4b\u9593\u7684\u7d81\u5b9a\u4f9d\u7136\u5b58\u5728\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u9589\u5305\u7684\u7b2c\u4e00\u500b\u95dc\u9375\u9ede\u662f\u9589\u5305\u662f\u4e00\u6bb5\u4ee3\u78bc\u52a0\u4e0a\u548c\u5b9a\u7fa9\u5b83\u7684\u74b0\u5883\u4e4b\u9593\u7684\u7d81\u5b9a\uff08they are a block of code plus the bindings to the environment they came from\uff09\u3002\u9019\u662f\u9589\u5305\u548c\u51fd\u6578\u6307\u91dd\u7b49\u5176\u5b83\u76f8\u4f3c\u6280\u8853\u7684\u4e0d\u540c\u9ede\uff08java\u533f\u540d\u5167\u985e\u53ef\u4ee5\u8a2a\u554f\u5c40\u90e8\u8b8a\u91cf\uff0c\u4f46\u662f\u53ea\u6709\u7576\u9019\u4e9b\u5167\u985e\u662ffinal\u7684\u6642\u5019\u624d\u884c\uff09\u3002<\/p>\n<p>\u7b2c\u4e8c\u500b\u4e0d\u540c\u9ede\u4e0d\u662f\u5b9a\u7fa9\u5f62\u5f0f\u7684\u4e0d\u540c\uff0c\u4f46\u662f\u4e5f\u540c\u6a23\u91cd\u8981\u3002\uff08The second difference is less of a defined formal difference, but is just as important, if not more so in practice\uff09\u3002\u652f\u6301\u9589\u5305\u7684\u8a9e\u8a00\u5141\u8a31\u4f60\u7528\u5f88\u5c11\u7684\u8a9e\u6cd5\u53bb\u5b9a\u7fa9\u4e00\u500b\u9589\u5305\uff0c\u5118\u7ba1\u9019\u9ede\u53ef\u80fd\u4e0d\u662f\u5f88\u91cd\u8981\u7684\u4e00\u9ede\uff0c\u4f46\u6211\u76f8\u4fe1\u9019\u9ede\u662f\u81f3\u95dc\u91cd\u8981\u7684\uff0d\u9019\u662f\u4f7f\u5f97\u4eba\u5011\u80fd\u5f88\u81ea\u7136 \u7684\u4f7f\u7528\u9589\u5305\u7684\u95dc\u9375\u9ede\u3002\u770b\u770bLisp\uff0cSmalltalk\u548cRuby\uff0c\u9589\u5305\u904d\u5e03\u5404\u8655\uff0d\u6bd4\u5176\u5b83\u8a9e\u8a00\u4e2d\u985e\u4f3c\u7684\u4f7f\u7528\u591a\u5f88\u591a\u3002\u7d81\u5b9a\u5c40\u90e8\u8b8a\u91cf\u662f\u5b83\u7684\u7279\u9ede\u4e4b\u4e00\uff0c\u4f46\u6211\u60f3\u6700 \u5927\u7684\u539f\u56e0\u662f\u4f7f\u7528\u9589\u5305\u7684\u8a9e\u6cd5\u548c\u7b26\u865f\u975e\u5e38\u7c21\u55ae\u548c\u6e05\u695a\u3002<\/p>\n<p>\u4e00\u500b\u5f88\u597d\u7684\u76f8\u95dc\u4f8b\u5b50\u662f\u5f9eSmalltalk\u7a0b\u5e8f\u54e1\u5230JAVA\u7a0b\u5e8f\u54e1\uff0c\u958b\u59cb\u6642\u5f88\u591a\u4eba\uff0c\u5305\u62ec\u6211\uff0c\u8a66\u9a57\u6027\u7684\u5c07\u5728Smalltalk\u4e2d\u4f7f\u7528\u9589\u5305\u7684\u5730\u65b9\u5728Java\u4e2d\u4f7f\u7528\u533f\u540d\u5167\u985e\u4f86\u5be6\u73fe\u3002\u4f46\u7d50\u679c\u4f7f\u5f97\u4ee3\u78bc\u8b8a\u5f97\u6df7\u4e82\u96e3\u770b\uff0c\u6240\u4ee5\u6211\u5011\u4e0d\u5f97\u4e0d\u653e\u68c4\u3002<\/p>\n<p>\u6211\u5728Ruby\u7d93\u5e38\u4f7f\u7528\u9589\u5305\uff0c\u4f46\u6211\u4e0d\u6253\u7b97\u5275\u5efaProc\u5c0d\u8c61\uff0c\u7136\u5f8c\u50b3\u4f86\u50b3\u53bb\u3002\u5927\u591a\u6578\u6642\u9593\u6211\u7528\u9589\u5305\u4f86\u8655\u7406\u524d\u9762\u6211\u63d0\u5230\u7684select\u7b49\u57fa\u65bc\u96c6\u5408\u5c0d\u8c61\u7684\u65b9\u6cd5\u3002\u9589\u5305\u53e6\u4e00\u500b\u91cd\u8981\u7528\u9014\u662f\u2019execute around method\u2019\uff0c\u6bd4\u5982\u8655\u7406\u4e00\u500b\u6587\u4ef6\uff1a<\/p>\n<blockquote><p>File.open(filename) {|f| doSomethingWithFile(f)}<\/p><\/blockquote>\n<p>\u9019\u88e1open\u65b9\u6cd5\u6253\u958b\u4e00\u500b\u6587\u4ef6\uff0c\u7136\u5f8c\u57f7\u884c\u7d66\u5b9a\u7684block\uff0c\u7136\u5f8c\u95dc\u9589\u5b83\u3002\u9019\u6a23\u8655\u7406\u975e\u5e38\u65b9\u4fbf\uff0c\u5c24\u5176\u662f\u5c0d\u4e8b\u52d9\uff08\u8981\u6c42commit\u6216\u8005rollback\uff09\uff0c\u6216\u8005\u5176\u5b83\u7684\u4f60\u9700\u8981\u5728\u8655\u7406\u7d50\u675f\u6642\u5019\u4f5c\u4e00\u4e9b\u6536\u5c3e\u8655\u7406\u7684\u4e8b\u60c5\u3002\u6211\u5728\u6211\u7684xml\u6587\u6a94\u8f49\u63db\u4e2d\u5ee3\u6cdb\u4f7f\u7528\u9019\u500b\u512a\u9ede\u3002<\/p>\n<p>\u9589\u5305\u7684\u9019\u4e9b\u7528\u6cd5\u986f\u7136\u9060\u4e0d\u5982\u7528Lisp\u8a9e\u8a00\u7684\u4eba\u9047\u5230\u7684\u591a\uff0c\u5373\u4f7f\u6211\uff0c\u5728\u4f7f\u7528\u6c92\u6709\u9589\u5305\u652f\u6301\u7684\u8a9e\u8a00\u7684\u6642\u5019\uff0c\u4e5f\u6703\u60f3\u5ff5\u9019\u4e9b\u6771\u897f\u3002\u9589\u5305\u5c31\u50cf\u4e00\u4e9b\u4f60\u7b2c\u4e00\u773c\u898b\u5230\u89ba\u5f97\u4e0d\u600e\u9ebc\u6a23\u7684\u6771\u897f\uff0c\u4f46\u4f60\u5f88\u5feb\u5c31\u6703\u559c\u6b61\u4e0a\u5b83\u5011\u3002<\/p>\n<p>\u5176\u5b83\u8a9e\u8a00\u4f8b\u5b50<\/p>\n<p>Joe Walnes\u5728blog\u4e2d\u63d0\u4f9b\u4e86 closures in the next version of C#\u3002\u9019\u500b\u4f8b\u5b50\u662f\u975c\u614b\u985e\u578b\u8a9e\u8a00\u7684\uff0c\u57fa\u65bcdelegate\uff0c\u4e14\u9700\u8981delegate\u95dc\u9375\u5b57\u3002<\/p>\n<p>\u66f4\u65b0: Ivan Moore\u63d0\u4f9b\u985e\u985e\u4f3c\u7684 Python \u7684\u4f8b\u5b50<\/p>\n<p>\u66f4\u65b0: Vadim Nasardinov \u8b93\u6211\u77e5\u9053\u4e86\u4f86\u81eaGuy Steeleled\u7684 closures in Java \u9019\u500b\u6709\u8da3\u7684\u73cd\u805e\u3002\u00a0<\/p>\n<p>\u8b6f\u8005\u8a3b\uff1a\u5982\u4f60\u60f3\u77e5\u9053\u4e0a\u9762\u4f8b\u5b50\u4e2d\u6587\u4ef6\u5c0d\u50cf\u662f\u600e\u9ebc\u81ea\u5df1\u95dc\u9589\u7684\uff0c\u8acb\u770b<a href=\"http:\/\/blog.csdn.net\/ruby_cn\/archive\/2004\/11\/23\/192588.aspx\">blog.csdn.net\/ruby_cn\/archive\/2004\/11\/23\/192588.aspx<\/a>\uff0c\u5e0c\u671b\u53ef\u4ee5\u627e\u5230\u7b54\u6848\u3002\u7ffb\u8b6f\u7684\u4e0d\u597d\uff0c\u8acb\u591a\u539f\u8ad2\u3002\u6b61\u8fce\u4ea4\u6d41\u3002\u62ec\u865f\u4e4b\u4e2d\u7684\u82f1\u8a9e\u5be6\u5728\u662f\u4e0d\u77e5\u5982\u4f55\u5f88\u597d\u7ffb\u8b6f\uff0c\u6240\u4ee5\u4fdd\u7559\u4e86\u4e0b\u4f86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u56e0\u70ba\u6211\u9023\u4e0d\u5230\u539f\u4e2d\u6587\u7ffb\u8b6f\u7684\u7db2\u5740\u4e86\uff0c\u6240\u4ee5\u53ea\u597d\u628a\u627e\u5230\u7684\u6587\u7ae0\u8f49\u8cbc\u904e\u4f86\u3002Closure \u548c Block \u662f Ruby \u4e2d &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ihower.tw\/blog\/1456-%e8%bd%89%e8%bc%89-closure-%e6%96%87%e7%ab%a0\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008[\u8f49\u8f09] Closure \u7ffb\u8b6f\u6587\u7ae0\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,31],"tags":[],"class_list":["post-1456","post","type-post","status-publish","format-standard","hentry","category-programming","category-ruby","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1q6tG-nu","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/1456","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/comments?post=1456"}],"version-history":[{"count":0,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/1456\/revisions"}],"wp:attachment":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/media?parent=1456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/categories?post=1456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/tags?post=1456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}