Sha256: 3dfe2b84c05d7011712bd09a860fa4a30768f6d4b1fdff73ffb669f6d9e86863

Contents?: true

Size: 421 Bytes

Versions: 6

Compression:

Stored size: 421 Bytes

Contents

module Qlang
  module Parser
    module MatrixParser
      include Base
      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
      module_function :execute
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
qlang-0.0.27182123 lib/qlang/parser/matrix_parser.rb
qlang-0.0.27182122 lib/qlang/parser/matrix_parser.rb
qlang-0.0.27182121 lib/qlang/parser/matrix_parser.rb
qlang-0.0.27182120 lib/qlang/parser/matrix_parser.rb
qlang-0.0.27182110 lib/qlang/parser/matrix_parser.rb
qlang-0.0.27182100 lib/qlang/parser/matrix_parser.rb