Ruby is not my normal language, and I'm struggling to get the following to work.
I'm just working with an array.
irb(main):54232:0> contact_data
=> ["3521", "xxxxxxxx@xxxxxx.com", "ADA JONES SMITH"]
irb(main):54226:0> contact_data[2].split.first.to_s.camelize
=> "ADA"
Why? and how do I convert the string to CamelCase?
Thank you.
Use downcase
:
contact_data[2].split.first.to_s.downcase.camelize
Also titleize
is useful method for your task.
2.1.2 :002 > "ADA".titleize
=> "Ada"