JavaScript世界:学习CoffeeScript语言(五)
由Gudao Luo在2011-06-23 at 23:50发表的
JavaScript世界:学习CoffeeScript语言(四)
由Gudao Luo在2011-06-20 at 07:19发表的
JavaScript世界:学习CoffeeScript语言(三)
由Gudao Luo在2011-06-19 at 00:43发表的
JavaScript世界:学习CoffeeScript语言(二)
由Gudao Luo在2011-06-17 at 00:19发表的
- 道喜评论
- 关键词class/constructor/this之前的空格不能多,也不能少。
- 关键词constructor之前是一个(或者两个)空格或者Tab键;关键词this之前是两个(或者四个)空格或者Tab键;
- 参考资料
- http://jashkenas.github.com/coffee-script/
- Javascript继承机制的设计思想 http://www.ruanyifeng.com/blog/2011/06/designing_ideas_of_inheritance_mechanism_in_javascript.html
JavaScript世界:学习CoffeeScript语言(一)
由Gudao Luo在2011-06-16 at 00:36发表的
- 参考资料
- http://jashkenas.github.com/coffee-script/
- Javascript继承机制的设计思想 http://www.ruanyifeng.com/blog/2011/06/designing_ideas_of_inheritance_mechanism_in_javascript.html
代码世界:如何理解Ruby类及其函数?
由Gudao Luo在2010-02-16 at 18:15发表的

- 说明
- 首先要理解类的函数是什么意思。
- 其次类没有我们所需要的函数,但是有自己想法。
- 最后就自己写个相关函数,与大家共享。
- 参考资料
- http://chinaonrails.com/topic/view/3730.html http://chinaonrails.com/topic/view/3730.html
- http://ruby-doc.org/core/classes/Array.html http://ruby-doc.org/core/classes/Array.html
- http://carsonified.com/blog/dev/ruby-arrays/ http://carsonified.com/blog/dev/ruby-arrays/
- http://tinyurl.com/yge2k4c http://tinyurl.com/yge2k4c
代码世界:Ruby/Rails反射技术实例
由Gudao Luo在2009-07-11 at 06:51发表的

- 使用正常类方法代码
@blogs = Blog.find(:all)- 使用反射技术代码(Ruby语言)
@blogs = Kernel.const_get("Blog").send(:find, :all)
@blogs = Object.const_get("Blog").send(:find, :all)
@blogs = Kernel.eval("Blog").send(:find, :all)- 使用反射技术代码(类名称包含”::”)(Ruby语言)
Model = "ActiveRecord::Base".split('::').inject(Object) do |base,item|
base.const_get(item)
end
class Blog < Model; end- 使用反射技术代码(Rails框架)
@blogs = "Blog".classify.constantize.send(:find, :all)
