So I have a array, where key:value are recorded as single unit. I want to split the array and record key and value as an individual.
Example
array = ["Image loaded:", "RuleName: xx", "UtcTime: xxx", "ProcessGuid: {xxx}", "ProcessId: 884", "Image: C:\\opt\\td-agent\\bin\\ruby.exe", "ImageLoaded: xxx", "FileVersion: -", "Description: -", "Product: -", "Company: -", "OriginalFileName: -", "Hashes: MD5=xxx", "Signed: false", "Signature: -", "SignatureStatus: Unavailable", "User: xx"]
Now given I want to loop it and extract key:value
LOOP THROUGH ARRAY
array[i] = array.split(',',key,value)
print(key)
print(value)
Array.instance_methods.include?(:split) #=> false. When you give an example please show the desired result (here a hash). Lastly, there is no need forarrayto have so many elements.