Ruby には empty?nil? など、接尾辞"?"がつくメソッドを使えるので直感的にわかりやすい場合が多いのですが、三項演算子 ?: の条件に使う時だけは

ruby>>
foo.empty? ? bar : baz
<<--

のように ? ? が連続してなんだか気に入りません。
なので、こういう場合には三項演算子の代わりに

ruby>>
foo.empty? and bar or baz
<<--

と書くことが多いかも。これだとスッキリします

posted by genki genki on Sun 11 Aug 2013 at 16:57 with 0 comments
Contents rssrss
光ファイバーを二次元振動させて走査するAR用ディスプレイ
因果の取り違え
Swift2's defer for CoffeeScript
mongodb-3.0からcreateIndexのdropDupsが無くなったらしい
mongodb-3.0以降のWiredTigerの設定を動的に変更する方法
一般楕円の高速生成アルゴリズムへの道標
farro mantecatoのレシピ
Droonga関連の記事のまとめ
RuntimeErrorの特定のメッセージに限定してrescueする方法
jQueryでscriptタグを実行せずにappendする
Tags
coffeescriptdefergroongajsmemonodenodejs
Comments rssrss
https://robindigital.ir https://robindigital.ir: درود، من امروز به صورت کاملا تصادفی در فضای وب ب... 04/27 20:26
https://xn--son7-01a.cc/ https://xn--son7-01a.cc/: В этом тексте собран углублённый обзор. Если по д... 04/27 19:17
https://pajooheshray.ir https://pajooheshray.ir: وقت بخیر، خودم دیروز اتفاقی در اینترنت با این وب... 04/27 16:03
https://eana.ir https://eana.ir: سلام، خودم امروز به صورت کاملا تصادفی در فضای وب ب... 04/27 12:51
https://dark-webmarket.com https://dark-webmarket.com: Dark web market counterfeit documents range from t... 04/27 07:01
https://dark-webmarket.com https://dark-webmarket.com: The dark web market documents category has surpris... 04/27 05:31
https://kit-s.ru/bitrix/redirect.php?event1=catalog_out&event2=%2Fupload%2Fiblock%2F134%2F1348468d79304618586dffac49c7a79c.jpg&event3=64ea70f0-11c1-11ea-80eb-ac1f6bd1d451_07e9cc72-1d6e-11ea-80f2-ac1f6bd1d451.jpg&goto=http%3a%2f%2fhatamatata.ru%2Fturkey%2Fankara-province%2Foffice%2F https://kit-s.ru/bitrix/redirect.php?event1=catalog_out&event2=%2Fupload%2Fiblock%2F134%2F1348468d79304618586dffac49c7a79c.jpg&event3=64ea70f0-11c1-11ea-80eb-ac1f6bd1d451_07e9cc72-1d6e-11ea-80f2-ac1f6bd1d451.jpg&goto=http%3a%2f%2fhatamatata.ru%2Fturkey%2Fankara-province%2Foffice%2F: Жильё в Турции обозначаются формулой «спальни плюс... 04/26 20:41
https://bisoncasino-hu.com/ https://bisoncasino-hu.com/: You are so cool! I don't believe I have read a s... 04/26 15:49