Sha256: 2d9a1bb9ce11033ac8e647ca3e8a587b0f091dd5b8d1e6416028de16936d7920

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 Bytes

Contents

module LensProtocol
  module OMA
    module Types
      class Matrix < Type
        def parse line, next_lines
          same_label_lines, next_lines = next_lines.partition { |other_line| other_line.label == line.label }
          values = [line, *same_label_lines].map { |line| parse_values line.data }
          [values, next_lines]
        end

        def format label, values
          values.map { |v| build_line label, format_values(v) }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lens_protocol-0.2.1 lib/lens_protocol/oma/types/matrix.rb
lens_protocol-0.2.0 lib/lens_protocol/oma/types/matrix.rb