Sha256: fff332cb5328edc2dca0246c990b3a1195227f53fd6abf06993caf23f41ef2e0
Contents?: true
Size: 867 Bytes
Versions: 2
Compression:
Stored size: 867 Bytes
Contents
module LensProtocol module OMA module Type class Trcfmt < Base def parse line, message label, values = label_and_values line side = side_position_from_trcfmt values message.add_record_side_values(label, side, values).set_context(:last_trcfmt_side, side) end def format record, message Array(record.value).select { |v| v&.any? }.flat_map do |values| trcfmt_line = format_line(record.label, values) side = side_position_from_trcfmt values r_lines = message.value_of('R', [[], []])[side].each_slice(10).map do |group| format_line('R', group) end [trcfmt_line, *r_lines] end end def side_position_from_trcfmt values values[3] == 'R' ? 0 : 1 end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lens_protocol-0.1.1 | lib/lens_protocol/oma/type/trcfmt.rb |
lens_protocol-0.1.0 | lib/lens_protocol/oma/type/trcfmt.rb |