书籍 I find a so good way to study ruby.

gazeldx · 2012年11月08日 · 最后由 Boyan 回复于 2013年02月15日 · 2529 次阅读

This book is contained in the Rubyinstaller for windows. It is in the folder of /doc . http://www.sapphiresteel.com/The-Book-Of-Ruby Download this book: http://www.sapphiresteel.com/IMG/zip/book-of-ruby.zip Good Luck!

Pay attention to this post! It's so great book for you!

#1 楼 @gazeldx 有什么独特的地方吗?

Don't ask me. You just read it!

This is an example from this book. If you feel misunderstanding, you may need to read the book!

Great example!

class MyClass @@classvar = 1000 @instvar = 1000

def MyClass.classMethod if @instvar == nil then @instvar = 10 else @instvar += 10 end

if @@classvar == nil then @@classvar = 10 else @@classvar += 10 end
end

def instanceMethod puts "init instance Method" if @instvar == nil then @instvar = 1 else @instvar += 1 end

if @@classvar == nil then @@classvar = 1 else @@classvar += 1 end

end

def showVars return "(instance method) @instvar = #{@instvar}, @@classvar = #{@@classvar}" end

def MyClass.showVars return "(class method) @instvar = #{@instvar}, @@classvar = #{@@classvar}" end

end

puts( MyClass.showVars ) puts( '--------------' ) for i in 0..2 do
ob = MyClass.new MyClass.classMethod ob.instanceMethod puts( MyClass.showVars ) puts( ob.showVars ) end

书中代码使用 comic sans 字体,好有个性 -_-

看这封面就让人想到了《The Linux Command Line》... 楼主发的这个下载链接,下载的文件是 09 年版的,还没有目录,刚在爱问上搜到个 11 年版有目录的,默默把地址贴上: http://ishare.iask.sina.com.cn/f/19980009.html

需要 登录 后方可回复, 如果你还没有账号请 注册新账号