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