Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

ruby array 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!!
Comment

PREVIOUS NEXT
Code Example
Ruby :: how to write CSV file in rails 
Ruby :: ruby timestamp 
Ruby :: ruby create csv 
Ruby :: ruby rails activerecord to array hash 
Ruby :: how to add to an array ruby 
Ruby :: how to add font awesome icon in button for submit rails 
Ruby :: ruby read stdin 
Ruby :: ruby loop each with index 
Ruby :: linked list in ruby 
Ruby :: rails filter hashes by key value 
Ruby :: rails g migration remove default 
Ruby :: rbenv and ruby different versions 
Ruby :: rails 10 times do 
Ruby :: insert element in array ruby 
Ruby :: how to destroy a generate in rails 
Ruby :: While executing gem 
Ruby :: ruby random number between 
Ruby :: ruby get ascii value of character 
Ruby :: ruby get min value from array 
Ruby :: add elements to ruby hashes 
Ruby :: run method before rails 
Ruby :: devise signout via get with https 
Ruby :: start times from 1 in ruby 
Ruby :: rails .map unless nil 
Ruby :: how to install webpck on ubuntu globally 
Ruby :: rails activerecord saved_change_to 
R :: export csv in r 
R :: find data type of vector r 
R :: why is correlation na in r 
R :: ggplot - blank title of axis 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =