Daily Archives: 2013-10-31

Ruby 百分号创建数组小写 w 和大写的区别

%W 使用双引号处理内容 %w 使用单引号处理内容 看例子: myvar = ‘one’ p %w{#{myvar} two three 1 2 3} # => ["\#{myvar}", "two", "three", "1", "2", "3"] p %W{#{myvar} two three 1 2 3} # => ["one", "two", "three", "1", "2", "3"]

Posted in ruby on rails | Tagged | Leave a comment