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

Óà Ruby ²È²ÈËÄÈ˰ï




ÉÏÉÏÖÜÔÚÊéµê¿´µ½Ò»±¾¡¶Ruby
Éè¼ÆÄ£Ê½¡·£¬¼ñÆðÀ´ 10 ·ÖÖÓ¿´Í꣬ÈÓÁË£¨±ðÎÊÎÒΪʲô……£©
ÏÂÃæÓÃ Ruby
ддÉè¼ÆÄ£Ê½£¬Ë³±ãÅúÒ»Åú Java ºÍ Gof
¡£
1.Factory
ºÍ Abstract Factory
class
 Factory  
  attr_accessor :product
  
  def
 produce  
    @product
.new
  
  end
  
end
  
class
 Product  
  #..
  
end
  
fac = Factory.new
  
fac.product = Product  
fac.produce  
class Factory
attr_accessor :product
def produce
@product.new
end
end
class Product
#..
end
fac = Factory.new
fac.product = Product
fac.produce
JavaдµÄ¹¤³§ÓÐÕâô¼òµ¥£¬ÕâôÈÝÒ×ÖØÓÃô£¿
2.Builder
# ¹¤Í·
  
class
 Director  
  def
 build_with builder  
    acc = ''
  
    [:header
, :body
, :footer
].each
 do
 |m|  
      acc += builder.__send__ m if
 builder.respond_to? m  
    end
  
    acc  
  end
  
end
  
# ¹¤ÈË
  
class
 HTMLBuilder  
  def
 header; '<html><title>html builder</title>'
;end
  
  def
 body;   '<body>html builder</body>'
        ;end
  
  def
 footer; '</html>'
                          ;end
  
end
 


Ïà¹ØÎĵµ£º

ruby gui¿ª·¢

http://zh.wikipedia.org/wiki/WxWidgets ÖÐÎĵÄ
http://zh.wikipedia.org/zh-cn/WxWidgets ¼òÌåÖÐÎÄ
http://wxruby.rubyforge.org/wiki/wiki.pl?Using_GUI_Designers  
http://visualwx.altervista.org/   RAD http://www.wxwidgets.org/
http://wiki.wxwidgets.org/Main_Page ......

Ruby on Rails(ROR)

¶¨Òå
¡¡RoRÊÇRuby on RailsµÄËõд¡£Ruby on RailsÊÇÒ»¸öÓÃÓÚ±àÐ´ÍøÂçÓ¦ÓóÌÐòµÄ¿ò¼Ü£¬Ëü»ùÓÚ¼ÆËã»úÈí¼þÓïÑÔRuby£¬¸ø³ÌÐò¿ª·¢ÈËÔ±Ìṩǿ´óµÄ¿ò¼ÜÖ§³Ö¡£Ruby on Rails°üÀ¨Á½²¿·ÖÄÚÈÝ£ºRubyÓïÑÔºÍRails¿ò¼Ü¡£
ʲôÊÇRuby?
¡¡¡¡Ruby ÓïÑÔÊÇÒ»ÖÖ¶¯Ì¬ÓïÑÔ£¬ËüÓëPython¡¢SmalltalkºÍPerlÕâ3ÖÖ±à³ÌÓïÑÔÓÐЩÀàËÆ¡£RubyÓïÑÔÆðÔ´ÓÚÈ ......

RUBY EXCEL²Ù×÷

 ÓÃrubyн¨Ò»¸öexcelÎļþ£¬²¢ÇÒÉèÖÃһЩֵ¡£
 require 'win32ole'
excel = WIN32OLE.new("excel.application")       
excel.Visible = true
excel.WorkBooks.Open("d:\\test.xls")
excel.WorkSheets("sheet1").Activate
excel.Cells(2,3).value = "ÕÅÈý"
exce ......

rubyÎļþ²Ù×÷

1¡¢ÎļþµÄ´ò¿ªÓë¹Ø±Õ
    ``r'' Read-only, starts at beginning of file (default mode).
    ``r+'' Read-write, starts at beginning of file.
    ``w'' Write-only, truncates existing file to zero length or creates a new file for writing. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ