- 浏览: 58534 次
- 性别:
- 来自: 深圳
最新评论
=begin
def test1(*a)
p a.first
p a.last
p a.length
end
test1(3,6)
#>>
#3
#6
#2
<<
=end
=begin
def test2(a,*b)
p a
p b
p b.length
p b.first
end
test2(1)
test2(1,:a => 1, :b => 2)
#>>
#1
#[]
#0
#nil
#1
#[{:a=>1, :b=>2}]
#1
#{:a=>1, :b=>2}
#<<
=end
=begin
def test3(a,b,*c)
p a
p b
p b.length
p c
p c.length
end
test3(1,:a => 1, :b => 2)
#>>
#1
#{:a=>1, :b=>2}
#2
#[]
#0
#<<
=end
=begin
def test3(a,b,c={})
p a
p b
p b.length
p c
p c.length
end
test3(1,:a => 1, :b => 2)
#>>
#1
#{:a=>1, :b=>2}
#2
#{}
#0
#<<
=end
=begin
def test3(a,b,c)
p a
p b
p b.length
p c
p c.length
end
test3(1,:a => 1, :b => 2)
#>>
#test.rb:81:in `test3': wrong number of arguments (2 for 3) (ArgumentError)
# from test.rb:81
#<<
=end
=begin
def test4(a,b)
p a
p b
end
test4(*[2,3])
#>>
#2
#3
#<<
=end
=begin
def a(a, *b, &block)
p a
p b
block.call
end
a(3,4) {puts "aaa"}
#>>
#3
#4
#aaa
#<<
=end
=begin
def a(a, *b, &block)
p a
p b
block.call
end
a(3) {puts "aaa"}
#>>
#3
#[]
#aaa
#<<
=end
#def link_to(name,options={},html_options=nil)
# p name
# p options
#end
#def link_to_tag(name,options={},html_options=nil,*parameters_for_method_reference)
#link_to(name,options,html_options=nil,*parameters_for_method_reference)
#end
#link_to_tag("submit","http://www.sina.com",{:class=>"button"},["a","b"])
class A
@cached_settings = {}
def self.[](name)
v = @cached_settings[name]
v ? v : (@cached_settings[name] = rand(10))
end
end
p A["a"]
#p A["a"]
#p A["a"]
def test1(*a)
p a.first
p a.last
p a.length
end
test1(3,6)
#>>
#3
#6
#2
<<
=end
=begin
def test2(a,*b)
p a
p b
p b.length
p b.first
end
test2(1)
test2(1,:a => 1, :b => 2)
#>>
#1
#[]
#0
#nil
#1
#[{:a=>1, :b=>2}]
#1
#{:a=>1, :b=>2}
#<<
=end
=begin
def test3(a,b,*c)
p a
p b
p b.length
p c
p c.length
end
test3(1,:a => 1, :b => 2)
#>>
#1
#{:a=>1, :b=>2}
#2
#[]
#0
#<<
=end
=begin
def test3(a,b,c={})
p a
p b
p b.length
p c
p c.length
end
test3(1,:a => 1, :b => 2)
#>>
#1
#{:a=>1, :b=>2}
#2
#{}
#0
#<<
=end
=begin
def test3(a,b,c)
p a
p b
p b.length
p c
p c.length
end
test3(1,:a => 1, :b => 2)
#>>
#test.rb:81:in `test3': wrong number of arguments (2 for 3) (ArgumentError)
# from test.rb:81
#<<
=end
=begin
def test4(a,b)
p a
p b
end
test4(*[2,3])
#>>
#2
#3
#<<
=end
=begin
def a(a, *b, &block)
p a
p b
block.call
end
a(3,4) {puts "aaa"}
#>>
#3
#4
#aaa
#<<
=end
=begin
def a(a, *b, &block)
p a
p b
block.call
end
a(3) {puts "aaa"}
#>>
#3
#[]
#aaa
#<<
=end
#def link_to(name,options={},html_options=nil)
# p name
# p options
#end
#def link_to_tag(name,options={},html_options=nil,*parameters_for_method_reference)
#link_to(name,options,html_options=nil,*parameters_for_method_reference)
#end
#link_to_tag("submit","http://www.sina.com",{:class=>"button"},["a","b"])
class A
@cached_settings = {}
def self.[](name)
v = @cached_settings[name]
v ? v : (@cached_settings[name] = rand(10))
end
end
p A["a"]
#p A["a"]
#p A["a"]
发表评论
-
Diaspora 功能特性列表
2013-05-10 14:25 982Diaspora Function Features List ... -
rails scaffold getting the column list from existing table
2011-09-23 10:02 884之前一直找这个问题的解决办法,但一直没找到,在g上看到了一个人 ... -
Rails 3 用 JQuery 替代 Prototype
2011-07-28 22:48 11011.进入到工程目录中修改Gemfile文件,加入如下行: g ... -
Generate a list of Rails controllers and methods
2011-07-01 17:40 825列出项目中的controler和他对应的actions: @c ... -
Ubuntu手动安装JDK
2011-05-20 16:03 542Ubuntu手动安装JDK 安装前可以查看一下jdk版本,进 ... -
bundler
2011-04-25 12:12 804Rails3里多了个Bundler工具。 它是一个Librar ... -
研究小计1
2011-04-20 00:55 637有时候对一些基础的东西,不知道它的边界在哪里,其实做些小实验就 ... -
RubyGem version error: rack(1.0.0 not ~> 1.0.1)
2011-04-17 00:09 1331I have this error when I try to ... -
rubyonrails Restful Authentication 插件
2011-04-17 00:01 784restful_authentication是Rails的一个 ... -
XP.CMD命令大全
2011-04-17 00:00 612有关某个命令的详细信 ... -
几个有用的方法
2011-04-16 23:58 560hash.invert Returns a new hash ... -
Firefox键盘快捷方式
2011-04-16 23:55 1187Firefox键盘快捷方式 键盘快捷健 下面是 Mozil ... -
Ubuntu手动安装JDK
2011-04-16 23:53 709Ubuntu手动安装JDK 安装前可以查看一下jdk版本,进 ... -
字符转时间格式转换成时间对象
2011-04-16 23:52 720Time.parse("Wed, 23 Jan 20 ... -
使用Rails时遇到了服务器启动问题 script/server:3
2011-04-16 23:47 1265境 Windows Vista Home Premium c ... -
DoDirectPayment
2011-04-16 23:44 976DoDirectPayment 1. DoDirectPay ... -
Rails异常处理
2011-04-16 23:43 947异常处理是开发过程中 ... -
ruby和rails中的回调函数
2011-04-16 23:41 1857Ruby中Class,Object,Module这三个类定义了 ... -
深入理解alias, alias_method和alias_method_chain
2011-04-16 23:41 855对 于alias, alias_method, alias_m ... -
Rails3:使用bundler管理gems
2011-04-16 23:39 1371bundler是一套为了 Rails3 所打造的全新 Gem ...
相关推荐
ruby186-25 for windows
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
Ruby,一种为简单快捷的面向对象编程(面向对象程序设计)而创的脚本语言,在20世纪90年代由日本人松本行弘(まつもとゆきひろ/Yukihiro Matsumoto)开发,遵守GPL协议和Ruby License。...该版本为ruby-1.8.7-p302
ruby-1.9.2-p290.tar.gz,ruby,redmin,安装,
ruby-irb-1.8.7.352-13.el6.x86_64.rpm ruby-irb-1.8.7.352-13.el6.x86_64.rpm
ruby-debug-ide-0.3.1.gem
ruby官网文件,但官网的安装包下载速度过于缓慢, 此安装包的版本是2.6.5-1-x64 如果您不知道要安装哪个版本,并且开始使用Ruby,建议您使用Ruby + Devkit 2.6.X(x64)安装程序。它提供了最多数量的兼容gem,并与...
该资源从官方下载,由于官方资源速度实在产不忍赌,特在此分流。
ruby开发环境傻瓜一键安装for windows
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
mingw32-ruby-1.9.1-wxruby-2.0.1-setup.exe
ruby1-导出-1
ruby-debug-base19-0.11.26.gem
ruby19-core.chm
ruby对应数据库的必需gems包,包括最新的3个版本的dbi源码和gems安装包
ruby1-导出
0积分下载,不允许系统调分-20211115 ruby官方安装包
ruby1.86-doc (ruby 的 API)
Ruby学习资料(含参考手册和Programming Ruby)-中文.rar
博客“ruby+selenium-webdriver测试--第一个例子源代码”