I am trying to remove white space of array elements, but at the same time I want this to be inline replacement. Is something like this can be done..
lines[3..lines.length-4].map!(&:strip).delete_if { |table_name| table_name == "" }
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.
It does not work because
lines[3..lines.length-4]returns a new array, not a partial “reference” to the old one (so yourmap!is then just modifying in-place this new array).An idea: