什么是%W(阵列)是什么意思? [英] What does %w(array) mean?

查看:328
本文介绍了什么是%W(阵列)是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在看的文件实用程序的文档。我在下面一行困惑:

I'm looking at the documentation for FileUtils. I'm confused by the following line:

FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6'

什么是%重量是什么意思?你能指出我的文档?

What does the %w mean? Can you point me to the documentation?

推荐答案

%W(富吧) [foo的快捷方式酒吧] 。这意味着它写用空格代替逗号,没有他们周围引号分隔的字符串数组的符号。你可以找到在 zenspider的quickref 书写文字方式列表。

%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 find a list of ways of writing literals in zenspider's quickref.

这篇关于什么是%W(阵列)是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆