I have an array called people of these objects:
Nokogiri::XML::Text:0x3fe41985e69c "CEO, Company_1"
Nokogiri::XML::Text:0x3fe4194dab74 "COO, Company_2 "
Nokogiri::XML::Text:0x3fe4195eb414 "CFO, Company_3"
I want to split the objects at the "," so I tried to do something like this:
companies = people.each do | company |
company.inner_text.match("/, (.*)/")
end
and:
occupations = people.each do | occupation |
occupation.inner_text.match("/(.*),/")
end
match
doesn't seem to extract the values I want from the object. I checked rubular.com, and it should work, but I'm getting the same string I put in: "CEO, Company_1"
when it should be separated so that occupations = [CEO, COO, CFO]
and companies = [Company_1, Company_2, Company_3]
.
How do I split these objects?