道喜技术日记 .^. 天天红玉世界

Rails Ruby MacOSX 。。。创新来自于刻苦的实践和勤奋的思考... www.hhtong.com


Ruby世界:元编程函数一例

Gudao Luo2011-03-20 at 20:15发表的

  • 说明
    • 所有函数的不同内容都写入到变量legos中
    • 函数本身参数写入do之后的两竖之中

网络图书:《冒号课堂》,又名《冒号和他的学生们》

Gudao Luo2009-07-08 at 20:10发表的

《冒号课堂》,又名《冒号和他的学生们》
  • 说明
    • 《冒号课堂》,又名《冒号和他的学生们》是一本软件世界的通俗“小说”,值得一读。

代码世界:Ruby语言元编程的方法

Gudao Luo2008-08-06 at 04:31发表的

Ruby语言元编程的方法
使用函数eval
classname = 'Integer'
eval classname
(eval classname).to_s
eval classname + '.methods'
使用函数const_get
classname = 'Integer'
object = Kernel.const_get(classname)
object.methods
类Object的方法send
#Object.send(methodname)
#Object.send(methodname, parameter)
具体实例
class Company
def self.find(id)
id
end
end
company_id = 1
classname = 'Company'
object = Kernel.const_get(classname)
object.send(:find, company_id)
Company.find(company_id)
说明
# 最后两行代码从作用上而言是完全等价的
# 但是其编程实现方法是完全不同的
# 好比数学上的函数与泛函的相似概念

Rails框架网站推荐:Rails框架插件库

Gudao Luo2007-06-05 at 21:06发表的

Ruby语言分布框架

Gudao Luo2007-04-26 at 21:12发表的

  • Starfish
    • https://rubyforge.org/forum/message.php?msg_id=12909
    • http://typo.onxen.info/articles/2006/08/21/mapreduce-for-ruby-ridiculously-easy-distributed-programming
    • http://tech.rufy.com/2006/08/mapreduce-for-ruby-ridiculously-easy.html
  • 参考资料:
    • http://theexciter.com/files/oslo_rug_drb.pdf
    • http://rufy.com/distributed-programming/
    • http://tech.rufy.com/2006/08/mapreduce-for-ruby-ridiculously-easy.html
    • http://segment7.net/projects/ruby/drb/rinda/ringserver.html

目前最大的Ruby语言扩展库Ruby Facets

Gudao Luo2007-02-23 at 23:57发表的

  • 安装命令:
    • gem install facets -r
  • 说明:Ruby Facets最新版本1.8.51发行。

操纵网络页面和自动浏览页面工具Chickenfoot

Gudao Luo2007-02-20 at 22:57发表的

  • 说明:Firefox插件Chickenfoot是一个重要的软件开发工具,它定义了一些常用命令,让我们可以简单操纵网络页面,避免了写“低层面”的JavaScript,但是你要了解它的API。另外给个提示,该插件有5MB左右。