Module: Hilbert::Parser::MatrixParser
- Includes:
- Base
- Defined in:
- lib/hilbert/parser/matrix_parser.rb
Class Method Summary collapse
Class Method Details
.execute(els, opts = { trans: false }) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/hilbert/parser/matrix_parser.rb', line 5 def execute(els, opts = { trans: false }) trans = opts[:trans] rows = els.first.split(/ *(?:;|\n) */).map(&:split_by_sp) rows.all? { |row| row.count == rows.first.count } if trans rows = rows.transpose end MatrixApi.execute(rows) end |