How to read each array item into a map of key value pair?

Thanks @Badger for your response.

I am new to all ruby, ELK, and scripting languages. To process this line

n0-kkk size=11 inFlight=3 enqRate=22 deqRate=22

I added following ruby script but i am getting _rubyException tag i my events

ruby {
code => '
m = event.get("msg").scan(/([a-zA-Z]+)% ([^\s]*)/)
m.each { |x|
event.set("[someField][#{x[1]}]", x[0].to_i)
}
'
}

with the exception on console

Ruby exception occurred: undefined method scan' for #<Array:0x791262c2> {:class=>"NoMethodError", :backtrace=>["(ruby filter code):3:in block in filter_method'",

The first word in this line is non key value for this i need to add a key like name=

Thanks