In Rails guide this came up:
%w{ models }.each do |dir|
Could someone explain for me what %w{ models } means? Never seen it before. Is it ruby or rails specific.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
%w{ foo bar baz }creates an array["foo", "bar", "baz"], it’s a shortcut to save typing some quotes and commas.%{ models }just creates an array["models"], which does seem slightly superfluous, but is probably just for keeping the style consistent (?).