How to transform data through ruby code

Hi I’m a new on Ruby
Just I’m looking for the trick or method for transform the data, this code will be part of logstash pipeline

input data:
5-7-undefined-undefined-undefined-undefined-undefined-#0(bearer successful)-5|7-5-undefined-undefined-undefined-undefined-undefined-#0(bearer successful)-7

please notice that the pipe “|” split out the blocks of data, such blocks may occur a few times

for example, considering this is my header, which will be also the name of the fields:
EPS_BEARER_ID-BEARER_QCI-ARP_PL-ARP_PCI-ARP_PVI-GBR_UL-GBR_DL-BEARER_CAUSE-DEFAULT_BEARER_ID

then I need the date

eps_bearer_id_1 = 5
bearer_qci_1 = 7
ARP_PL_1 = 2
ARP_PCI_1 = disabled
ARP_PVI_1 = enabled
bearer_casue_default_1 = #0(bearer successful)
bearer_i_1 = 5

eps_bearer_id_2 = 5
bearer_qci_2 = 7
ARP_PL_2 = 2
ARP_PCI_2 = disabled
ARP_PVI_2 = enabled
bearer_casue_default_2 = #0(bearer successful)
bearer_i_2 = 5
[...]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs