Secondly,write a delegator in another way 1.Code a class extends DelegateClass,and set a parameter that you want to use 2.Implementing your method initialize ,and donot forget to write super method. 3.Implementing your method which match to a parameter before you passed 4.And now,let's code require ...
First of all, use SimpleDelegator class 1.first new a class 2.new another class extends SimpleDelegator,and donot forget require "delegate" at top of file 3.in this subclass ,super(obj) should be added in end of method initialize 4.let's look at code require 'delegate' class Hello def hello ...
原文出处: http://www.regular-expressions.info/ruby.html 在Ruby中使用正则表达式 Ruby支持正则表达式作为其一项语言特性。在Ruby中,正则表达式被写作 /模版/修饰符 的形式,这里的"模版"就是正则表达式本身,而"修饰符"则是一系列不同选项字符的标识,另外,"修饰符"部分是可选的。这个语法特点从Perl借鉴而来。 Ruby支持如下的修饰符: /i 使正则表达式大小写不敏感(正则表达式本身是大小写敏感的) /m 使"."匹配新行。Ruby使用/m,然而Perl和其他很多编程语言使用/s来实现"点(.)匹配新行"。 /o 它将致使任何的 #{ ...
默海飞瀑
搜索本博客
博客分类
最近加入圈子
最新评论
评论排行榜