我有以下几点效果很好:
def steps
%w[hello billing confirmation]
end
steps.first
但我想这样做:
def step_title
%w['Upload a photo' 'Billing Info' 'Confirmation Screen']
end
steps.first
%w是如何允许的?我try 了谷歌搜索,但谷歌在这些类型的字符方面很弱.
谢谢
我有以下几点效果很好:
def steps
%w[hello billing confirmation]
end
steps.first
但我想这样做:
def step_title
%w['Upload a photo' 'Billing Info' 'Confirmation Screen']
end
steps.first
%w是如何允许的?我try 了谷歌搜索,但谷歌在这些类型的字符方面很弱.
谢谢
%w
创建一个"单词数组",并使用空格分隔每个值.由于要在另一个值上分隔(在本例中,是引号集之外的空格),所以只需使用标准数组:
['Upload a photo', 'Billing Info', 'Confirmation Screen']