%w(foo bar) is a shortcut for ["foo", "bar"]. Creates an array of the strings.
This is basically a way of converting text into an arary of strings!!
# Array of symbols
%i[address city state post_code country]
=> [:address, :city, :state, :post_code, :country]
# Array of strings
%w[address city state postal country]
=> ["address", "city", "state", "postal", "country"]
# Array of interpolated symbols
postal_label = 'zip'
%I[address city state #{postal_label} country]
=> [:address, :city, :state, :zip, :country]
# Array of interpolated strings
%W[address city state #{postal_label} country]
=> ["address", "city", "state", "zip", "country"]
# Instead of %i[] you may use %i{} or %i() or %i!!
%w(foo bar) is a shortcut for ["foo", "bar"]
%w(foo bar) is a shortcut for ["foo", "bar"]. Creates an array of the strings.
This is basically a way of converting text into an arary of strings!!
# Array of symbols
%i[address city state post_code country]
=> [:address, :city, :state, :post_code, :country]
# Array of strings
%w[address city state postal country]
=> ["address", "city", "state", "postal", "country"]
# Array of interpolated symbols
postal_label = 'zip'
%I[address city state #{postal_label} country]
=> [:address, :city, :state, :zip, :country]
# Array of interpolated strings
%W[address city state #{postal_label} country]
=> ["address", "city", "state", "zip", "country"]
# Instead of %i[] you may use %i{} or %i() or %i!!
%w(foo bar) is a shortcut for ["foo", "bar"]