lemonzc
lemonzc · 共 3 篇文章
Ruby 在 Notepad++ 上飞翔
1.notepad++ 简单介绍 notepad++可能大家都不陌生吧,它是一个很强大的编辑器,它的特性是,开放源代码, 支持多语言的,但是它目前只能运行在Windows平台下(缺点,都4.6的版本,还没看到能在其他os上的版本)。大家用过ruby下自带的SciTE吧,它使用的是 Scintilla edit component ,其实官方网站上说 SciTE本来只是作为Scintilla edit component 推广用的一个Demo。呵呵,notepad++也使用Scintilla edit component,所以感觉像是2兄弟。 notepad++的具体特征我就不详细说了,大家可…
2007-12-26T13:22:47Z · 评论(31)
类中的成员变量可以这样声明, 但访问不能用@
大家先看下面代码: class Person < Struct.new(:age) def say_age puts "say age: #{age}" if age != nil end def hello_age puts "hello age: #{age}" if age!=nil end end p = Person.new(30) p.say_age p.hello_age p.age = 20 p.say_age p.hello_age 输出是: say age: 30 hello age: 30 say age: 20 hello age: 20 如果使用: def say_…
2007-12-21T17:33:03Z · 评论(2)
migrate 中 create_table 的初步探索
搞了几天rails了,太magic了。所以搞不清楚,只知道调用。 今天深入去了解了下 create_table 大家给指点指点 先请看流程: 再看 SchemaStatement 类的create_table()代码 ruby 代码 # ====== Do not add a primary key column # create_table(:categories_suppliers, :id => false) do |t| # t.column :category_id, :integer # t.column :supplier_id, :integer # end # genera…
2007-12-21T11:17:44Z · 评论(2)