- 博客(8)
- 收藏
- 关注
原创 Comment in html.erb file
to comment a single line useto comment a whole block use a if false to surrond your code like thiscode to comment
2014-07-01 21:48:37
1118
原创 一些Ruby惯用法
1.%w(foo bar)or %w[foo bar] is a shortcut for ["foo", "bar"].Meaning it's a notation to write an array of strings separated by spaces instead of commas and without quotes around them. You can te
2014-01-27 16:52:58
691
转载 Ruby中通过require引用文件
转自: http://www.51testing.com/html/79/605679-851921.html一、引用单个文件:test目录下有两个文件file1.rb,file2.rb在file1.rb中: require 'file2'会报错,可以使用以下方法引用file2:1、require File.dirname(__FILE__)+'/file2'
2014-01-27 15:29:44
2496
原创 Ruby的time out机制
Ruby中的timeout机制是这样的:给timeout设置一个超时时限,若timeout后面的块内容执行时间超过了此时限,则引发异常,若没有超过此时限,则按原流程执行,相当于没有timeout。例如1 Ruby Code 12345678require 'timeout'begin time
2014-01-05 16:37:47
1472
原创 Ruby中单引号和双引号的区别
Ruby中使用引号括起字符表示字符串,但单引号和双引号有所不同。1. 单引号所括的内容不会做转义,直接就是字符串的内容。如: Ruby Code 1puts 'this is a test\n'结果为:2. 双引号中,Ruby会做更多事情。 首先Ruby会查找转义符‘\
2014-01-05 16:15:07
3362
转载 Array类的Sort()方法
Array类实现了数组中元素的冒泡排序。Sort()方法要求数组中的元素实现IComparable接口。如System.Int32和System.String实现了IComparable接口,所以下面的数组可以使用Array.Sort()。string[]>"Lili", "Heicer", "Lucy" };Array.Sort(names);foreach (string
2013-12-25 18:08:06
985
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人