Ruby(2008-04-06)
摘要:########################## Containers ############################# ########################## Arrays ################################# #The class Array holds a collection of object references. ...
阅读全文
posted @
2008-04-06 21:26
IT Person
阅读(224)
推荐(0)
Ruby(2008-02-19)
摘要:########################## Singletons and other Constructors ################## class MyLogger private_class_method:new @@logger = nil def MyLogger.create @@logger = new unless @@logger @@l...
阅读全文
posted @
2008-02-19 21:20
IT Person
阅读(293)
推荐(0)
Ruby(2008-02-17)
摘要:############################### Class ############################## class Song def initialize(name, artist, duration) @name = name @artist = artist @duration = duration end end #initializ...
阅读全文
posted @
2008-02-17 14:50
IT Person
阅读(319)
推荐(0)
Ruby(2008-02-16)
摘要:############################ Block ####################### def call_block puts "start of method" yield yield puts "end of method" end call_block {puts "in the block"} def call_block yield("hel...
阅读全文
posted @
2008-02-16 22:19
IT Person
阅读(215)
推荐(0)
Ruby(2008-02-10)
摘要:############################# Array And Hash ####################### #array with three elements a = [1, 'ca', 3.14] #access the first element puts(a[0]) #set the third element(nil means nothing) a[2...
阅读全文
posted @
2008-02-10 20:53
IT Person
阅读(295)
推荐(0)
Ruby(2008-02-07)
摘要:#first program #function defination def say_goodnight(name) result = "Good night, #{name}" return result end #function invoke puts say_goodnight('Pa') #capitalize method def say_goodnight(name) ...
阅读全文
posted @
2008-02-07 18:06
IT Person
阅读(186)
推荐(0)