lib/qlang/parser/matrix_parser.rb in qlang-0.0.27182000 vs lib/qlang/parser/matrix_parser.rb in qlang-0.0.27182100

- old
+ new

@@ -1,11 +1,11 @@ module Qlang module Parser module MatrixParser include Base - def execute(lexed_string, trans: false) - lexed_string.rms!(')','(', 't') - rows = lexed_string.split(/ *; */).map(&:split_by_sp) + 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)