Class: LensProtocol::OMA::Types::Matrix

Inherits:
Type
  • Object
show all
Defined in:
lib/lens_protocol/oma/types/matrix.rb

Instance Method Summary collapse

Methods inherited from Type

#initialize, #wrap

Constructor Details

This class inherits a constructor from LensProtocol::OMA::Types::Type

Instance Method Details

#format(label, values) ⇒ Object



11
12
13
# File 'lib/lens_protocol/oma/types/matrix.rb', line 11

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

#parse(line, next_lines) ⇒ Object



5
6
7
8
9
# File 'lib/lens_protocol/oma/types/matrix.rb', line 5

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