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
class BlueBalls < Tree
def initialize(tree)
@parent = tree;
end
def decorate
@parent.decorate
puts "Add blue balls"
end
end
class Angel < Tree
def initialize(tree)
@parent = tree;
end
def decorate
@parent.decorate
puts "An angel on the top"
end
end
tree = Angel.new(BlueBalls.new(RedBalls.new(Tree.new)))
tree.decorate
Ïà¹ØÎĵµ£º
While looking for information on the subject, I looked into the ONLamp article Extending Ruby with C by Garrett Rooney, the Extending Ruby chapter in the Pickaxe, README.EXT (located at /usr/share/doc/ruby1.8-dev/README.EXT.gz on my Ubuntu system) and got some help from Kjetil.
The resulting file c ......
×î½üÔÚ¿´John E.Hopcroft,Rajeev Motwani,Jeffrey D.Ullman Èý¾ÞͷдµÄIntroduction to Automata Theory,Language,and Computation£¬Ïëдһ¸öTuring »úÑéÖ¤Ò»ÏÂ×Ô¼ºÐ´µÄ×´Ì¬×ªÒÆº¯Êý¶Ô²»¶Ô¡£ÀÁµÃºÜ£¬ÍøÉÏËÑÁ˼¸¸ö²»´íµÄ¡£µ«Ruby Quiz ÉϵÄÕâ¸ö×î¼òµ¥¡£
162 Turing »ú
ÎÊÌâÃèÊö
Quiz
description by James Edward Gray ......
Ò»£¬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£»
³¢ÊÔ²»½âÑ¹Ö ......
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 ......
ÒòΪһ´ÎżȻµÄ»ú»á½Ó´¥ÁËRubyÓïÑÔ¡£È»ºóÏÂÔØÁËRuby Shoes¹¤¾ß¡£
·¢ÏÖRuby»¹ÊÇÂùÓÐȤµÄ¡£
»¨ÁËÒ»¶Îʱ¼äÊìϤÁËËüµÄÓï·¨¡£
ÏÂÃæÀ´ÊÔÊÔËüµÄÊó±ê¹¦ÄÜ¡£
Shoes.app do
#ͼƬ³õʼ»¯
@img = image "http://www.google.cn/intl/zh-CN/images/logo_cn.gif"
#ͼƬ¹ØÓÚÊó±êµÄµ÷ÓÃ
& ......