自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 Ruby的一些疑问

1、网点看到一断程序,[code="ruby"]def m1(a) puts 'invoke m1' puts aenddef self.m1(a) puts 'invoke self.m1' a = 20 superendm1 10[/code]运行结果如下:invoke self.m1invoke m120为何先运行s...

2012-01-26 01:01:29 120

原创 小巧强大的编辑软件SublimeText 2

小巧压缩包不到10M,可以通过安装插件扩展功能。还支持VIM模式,通过安装https://github.com/Kronuz/SublimeCodeIntel 插件后,能比较好的支持代码自动完成功能。一些技巧:会不断更新1、常用快捷键F7或Ctrl + b 运行当前文件,ruby文件可以直接运行。Ctrl + d 选取当前光标所在词组,Ctrl+d+d查找当前光标所在词组,并标亮...

2012-01-12 02:50:18 133

原创 RSpec测试框架

[code="ruby"]#参考http://www.slideshare.net/ihower/rspec-7394497#入门,框架require 'rspec'class Order #自定义类enddescribe Order do #一个类别 #可以Nested加入想要测试的方法是哪个 describe "#amount" do #通常用#开头...

2012-01-10 12:59:17 474

原创 [转]Ruby - DUP vs CLONE

http://railsblogger.blogspot.com/2009/03/ruby-dup-vs-clone.htmlRuby - DUP vs CLONEBoth DUP & CLONE can be used to create shallow copy of an object. Both copies the instance variables of obj. But...

2012-01-09 12:57:07 133

原创 [转]eval, class_eval, instance_eval和binding

http://www.cnblogs.com/rubylouvre/archive/2011/08/28/2112321.html前些天写html生成器的时候用到了erb,在生成html的时候是这么一句:html=tpl.result(binding)binding这个变量(Kernel的一个方法 T_T)有点古怪,就搜了下。它表示了ruby的当前作用域,没有任何对外可见的成员函数,唯...

2012-01-09 12:10:14 88

原创 [转]Ruby中的binding

http://kkito.cn/index.php/blog/getArticle/82/ruby_binding之前在看erb如何parse的时候发现使用了binding这个东东,没有怎么在意,后来发现很多地方都用到了这个binding。 仔细查了一下手册Objects of class Binding encapsulate the execution context at ...

2012-01-09 11:50:12 299

原创 [转]ROR 中的Nesting resources

[url]http://weblog.jamisbuck.org/2007/2/5/nesting-resources[/url]The RESTful routes feature in Rails makes it really, really simple to nest resources within each other. Just give a block to the “m...

2012-01-06 09:25:30 113

原创 [转]Method visibility in Ruby

From:[url]http://weblog.jamisbuck.org/2007/2/23/method-visibility-in-ruby[/url]A common point of confusion to even experienced Ruby programmers is the visibility of public, protected, and private me...

2012-01-04 12:37:47 80

原创 [转]Skinny Controller, Fat Model

不错的文章,出处:[url]http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model[/url]When first getting started with Rails, it is tempting to shove lots of logic in the view. I’ll admit that I was ...

2012-01-04 11:47:38 150

原创 [转]ActiveRecord教程系列2

出处:[url]http://syue.com/Software/Language/Ruby/740.html[/url](十一、并发处理)在学习Rails中的并发处理的处理前,我们先简单了解下并发处理的概念。  在有多个处理同时访问同一个数据库的应用程序中,可能会出现这样的情况,因为一个处理更新了数据库中的行,而使得另一个处理中持有的数据变得陈旧了。例如,A和B先后从数据库中提取了相...

2012-01-04 02:06:54 146

原创 [转]ActiveRecord教程系列1

出处:[url]http://syue.com/Software/Language/Ruby/713.html[/url](一、ActiveRecord基础)ActiveRecord是Rails提供的一个对象关系映射(ORM)层,从这篇开始,我们来了解Active Record的一些基础内容,连接数据库,映射表,访问数据等。  Active Record使用基本的ORM模式:表映射成类...

2012-01-03 13:56:31 213

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除