Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

×Ô¶¯»¯²âÊÔ֮·£¨Ò»£© ruby³õ̽

´Ó½ñÌìÆð²»ÔÙÀË·Ñʱ¼ä£¬¿ªÊ¼×ßÏò×Ô¶¯»¯²âÊÔÕâÌõ¹âÃ÷µÄµÀ·£¬²¢ÒԴһ¸ö×Ô¶¯»¯²âÊÔƽ̨ΪĿ±ê£¬²¢Õâ¸ö¹ý³ÌÒ»µãµãµÄ¼Ç¼ÏÂÀ´ºÍ´ó¼Ò·ÖÏí
Ê×ÏÈ£¬ÊÇruby»·¾³µÄ´î½¨
£¨1£©µ½rubyµÄ¹ÙÍø£ºhttp://www.ruby-lang.org/en/ÏÂÔØ ruby°²×°³ÌÐò;
      PS £ºÑ¡Ôñ ruby on windows,ÎÒÏÂÔصÄÊÇRuby 1.8.6 One-Click Installer
£¨2£©Ë«»÷ºó°²×°ruby£¬Ò»Â·next£¬È»ºófinish¾ÍÐУ¬Ä¬ÈÏ°²×°ÔÚcÅÌ
£¨3£©½øÈ뿪ʼ²Ëµ¥->ÔËÐÐ->cmd ÊäÈëruby -v²é¿´µ±Ç°µÄrubyµÄ°æ±¾ºÅ£¬ÀýÈçÎҵĻáÏÔʾ ruby 1.8.6
È»ºó£¬ÎÒÃÇÀ´³¢ÊÔÔËÐÐÒ»¸örubyµÄС³ÌÐò
£¨1£©½øÈ뿪ʼ²Ëµ¥->ÔËÐÐ->cmd ÊäÈëruby -e 'print "Ruby,I am Coming!"'
       ÆÁÄ»»áÏÔʾ £º Ruby£¬I am Coming!
       PS :ruby µÄº¬ÒåÊǸæËßϵͳ£¬ÎÒÒªÔËÐÐÒ»¸öruby³ÌÐòÁË
              -e   µÄº¬ÒåÊǸæËßϵͳ£¬°ïÎÒºóÃæµÄÒ»Ðе±×÷Ò»¸öruby½Å±¾À´ÔËÐÐ


Ïà¹ØÎĵµ£º

ruby FileÔõôÔÚÔ´ÎļþµÄ»ù´¡ÉÏÌí¼ÓÄÚÈÝ£¬¶ø²»ÊÇÖØд

ÓÐЩͬѧÌáÎÊ£ºÎÒдÊý¾Ýµ½ÎļþÖлá°ÑÀϵÄÊý¾ÝÌæ»»µô¡£
ÔõôÔÚÔ´ÎļþµÄ»ù´¡ÉÏÌí¼ÓÄÚÈÝ£¬¶ø²»ÊÇÖØд
¡¾ruby code¡¿
  def txt_write(value,memo)
      File.open("c:\\my_text.txt", 'a') do |f|  
        ......

Ruby on Rails°²×°ÓëÅäÖÃ

Ò»£¬Ruby°²×°£º
http://rubyforge.org/frs/download.php/29263/ruby186-26.exe
¹Ù·½ÍøÕ¾ÏÂÔØruby186-26(for windows)£¬Ä¬ÈÏ°²×°ruby£»
·¾¶c:\ruby
¶þ£¬railsÏÂÔØ°²×°£º
http://rubyforge.org/frs/download.php/29361/rails-2.0.2.zip
ÏÂÔØrails2.0.2.zip£¬½«ÆäcopyÖÁruby°²×°Â·¾¶£¬²¢¸ÄÃûΪrails.zip£»
³¢ÊÔ²»½âÑ¹Ö ......

rubyµÄExcel²Ù×÷

require 'win32ole'
excel = WIN32OLE::new('excel.Application')
workbook = excel.Workbooks.Open('E:\RubyApp\bmk.xls')
worksheet = workbook.Worksheets(1) #get hold of the first worksheet
worksheet.Select #bring it to the front -need sometimes to run macros, not for working with a worksheet from ru ......

PythonºÍRubyµÄ¶Ô±È£¬¾ÀÕýһЩÎó½â

PythonºÍRubyµÄ¶Ô±È£¬¾ÀÕýһЩÎó½â
ÏÂÃæÊÇÎÒÔÚ¿´Á½Æª¹ØÓÚPythonºÍRuby¶Ô±ÈµÄÎÄÕÂʱ£¬Ëù×÷µÄ¾ÀÕý£¬Ô­ÎĶ¼Êǹ㷺Á÷Ðеģ¬±È½ÏºÃÕÒ¡£
------------------------------------------------------
¡¶rubyºÍpythonµÄ±È½Ï¡·¸üÕýÒ»µãÊÂÇé
1¡¢Îĵµ¡¢¿ªÔ´ÏîÄ¿¡¢¿âÖ§³Ö£¬ÕâЩ¶«Î÷Ruby²»Òª¸úPython±È£¬²»ÊǼ¸¸öÊýÁ¿¼¶µÄÎÊÌ⣬ºÎ±ØÃ²Ë ......

RubyµÄ×°ÊÎÆ÷ģʽʵÏÖ

class Tree
def initialize
puts "Make a normal tree"
end
def decorate
puts "Make sure the tree won\'t fall"
end
end
class RedBalls < Tree
def initialize(tree)
@parent = tree;
end
def decorate
@parent.decorate
puts "Put on some red balls"
end
end ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ