]]>[Q&A]Ruby涓浣曞姩鎬佽皟鐢ㄧ被鍙婂叾鏂規(guī)硶http://m.tkk7.com/joinose/archive/2007/06/18/124941.html姘存櫠楸?/dc:creator>姘存櫠楸?/author>Mon, 18 Jun 2007 06:31:00 GMThttp://m.tkk7.com/joinose/archive/2007/06/18/124941.htmlhttp://m.tkk7.com/joinose/comments/124941.htmlhttp://m.tkk7.com/joinose/archive/2007/06/18/124941.html#Feedback0http://m.tkk7.com/joinose/comments/commentRss/124941.htmlhttp://m.tkk7.com/joinose/services/trackbacks/124941.htmlclass Klass def hello(word) return word end end
className='Klass' methodName='hello' param1='word' k=Kernel.const_get(className).new() if k.respond_to?(methodName) puts k.send(methodName,param1) end
]]>[Q&A]do鏄粈涔堟剰鎬?http://m.tkk7.com/joinose/archive/2007/04/05/108685.html姘存櫠楸?/dc:creator>姘存櫠楸?/author>Thu, 05 Apr 2007 05:44:00 GMThttp://m.tkk7.com/joinose/archive/2007/04/05/108685.htmlhttp://m.tkk7.com/joinose/comments/108685.htmlhttp://m.tkk7.com/joinose/archive/2007/04/05/108685.html#Feedback2http://m.tkk7.com/joinose/comments/commentRss/108685.htmlhttp://m.tkk7.com/joinose/services/trackbacks/108685.htmlgoogle浜嗕竴鎶?鍙戠幇鏈変釜瑙i噴搴旇姝g‘: When the block is longer than one line, it's more readable to begin it with the do keyword and end it with the end keyword 鐪嬫潵do鏄痓lock鐨勭敤娉?濡傛灉榪欎釜block涓琛屽啓涓嶅畬灝卞彲浠ョ敤do...end 渚嬪: [1,2,3].each { |i| puts i }鍙啓鎴?br>[1,2,3].each do |i| puts i end