按类别查询搜索结果
关于关键词 的检测结果,共 504
【Python/Ruby】 源码安装ruby
oceanswimmer | 2012-12-17 10:44:10 | 阅读(1500) | 评论(0)
导论本文将讲一下源码安装ruby的过程。环境Distribution : Red Hat Enterprise Linux AS release 4 (Nahant Update 3)OS : GNU/Linux 2.6.32_1-4-0-0 #1 SMP x86_64INSTALL_DIR : /home/lordzzr/local/ruby/行动下载源码包http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz解压$ tar -zxvf ruby-1.9.3-p327.tar.gz && cd ruby-1.【阅读全文】
hnynes | 2012-09-07 10:03:57 | 阅读(7439) | 评论(0)
lrfgjj2 | 2012-08-13 14:07:01 | 阅读(1424) | 评论(0)
horsley | 2012-08-10 11:05:09 | 阅读(2158) | 评论(0)
参考文章:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/108059众所周知,Ruby 语言从 Lisp 中学习了很多东西,可是 Lisp 语言家族中的宏 macro 却被刻意去除。 人民群众强烈要求 macro 的回归。以下是 Ruby 模拟宏的一个实例:#macros.rb:#----------# 定义两...【阅读全文】
horsley | 2012-08-09 14:58:15 | 阅读(2853) | 评论(0)
在 Ruby 中 block 代码块 可以用 {} 或者 do …end 包围。那么两者的区别是什么呢。原来它们的优先级别不同,看下面的例子:func g { } 等价于func ( g { } ),func g do … end 等价于 func(g) do … end可以理解为 {} 就近捆绑,优先级较高。http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDo...【阅读全文】
horsley | 2012-08-07 12:57:18 | 阅读(2387) | 评论(0)
ap0405209 | 2012-08-03 11:01:45 | 阅读(219) | 评论(0)
A.1 拟态方法 puts “hello,world” 这里的 puts 实际上是个方法,完整写法  puts(“hello,world”) 如【阅读全文】
horsley | 2012-08-02 22:52:32 | 阅读(3198) | 评论(0)
C.1 法术集数组参数把一组参数压入到一个数组中,perl 语言中也有类似用法。def my_method(*args)    args.map {|arg| arg.reverse }endmy_method('abc' , 'xyz' , '123' ) # => ["cba", "zyx", "321"]环绕别名从一个重新定...【阅读全文】
horsley | 2012-08-02 15:09:51 | 阅读(1405) | 评论(0)
A.1 拟态方法puts “hello,world”这里的 puts 实际上是个方法,完整写法 puts(“hello,world”)如果加上上下文,就是  self.puts(“hello,world”) 或者 main.puts(“hello,world”)。由此可知 puts 多半是 Object 的一个实例方法。去掉括号的写法使得它像个关键字,同时也...【阅读全文】
【Python/Ruby】 Ruby如何遍历目录?
kevin33643 | 2012-07-31 17:39:31 | 阅读(2295) | 评论(0)
kevin33643 | 2012-07-31 17:33:01 | 阅读(6048) | 评论(0)
horsley | 2012-07-31 10:36:08 | 阅读(1489) | 评论(0)
前言1、定义类实际上是在运行一段普通的代码2、本章关注:类宏、环绕别名、单间类 4.1 类定义揭秘1、可以在类定义中加入任何代码,因为我们实际上是在运行类定义。跟方法和块一样,类定义也会返回最后一条语句的值。2、在类定义中,类本身充当了当前对象 self 的角色。当前类1、无...【阅读全文】
horsley | 2012-07-27 00:18:51 | 阅读(1370) | 评论(0)
通过 Kernel#block_given?() 来询问当前方法调用是否包含块def a_method    return yield if block_given?    ’no block’enda_menthod # => ‘no block’a_method {“here’s a block”}...【阅读全文】
【Python/Ruby】 ruby上手
_LeiChan | 2012-07-21 22:26:07 | 阅读(3) | 评论(0)
【系统运维】 Ruby概述简单介绍
ruby126com | 2012-07-20 19:27:07 | 阅读(1503) | 评论(0)
horsley | 2012-07-13 18:19:45 | 阅读(1372) | 评论(0)
2.2 动态方法 p40通过 send 向接收者发送消息,如:obj.my_method(3) #等价于obj.send(:my_method,3)send 的第一个参数可以是字符串,也可以是符号。剩余参数(以及代码块)会直接传递给调用的方法。 符号:符号是不可变的。字符...【阅读全文】
yaxinzhu | 2012-07-11 15:15:08 | 阅读(3190) | 评论(0)
horsley | 2012-07-11 00:20:55 | 阅读(1101) | 评论(0)
1.2 打开类技术类可以直接用 class 打开,因此你可以任意往现有类中添加方法(注意有可能覆盖同名方法),当然这不是一种好的风格,但你有这种能力,在某些情况下你可以获得特殊的效果。class String    def to_alphanumeric     &...【阅读全文】
【Python/Ruby】 WebSocket for Ruby 学习
horsley | 2012-07-04 14:59:14 | 阅读(3001) | 评论(0)
horsley | 2012-07-02 14:54:47 | 阅读(3935) | 评论(0)