Sha256: f3da378ddeb0c503c09477928ecaf8a8a70706125049479bdfce1848c445882b

Contents?: true

Size: 425 Bytes

Versions: 2

Compression:

Stored size: 425 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

2 entries across 2 versions & 2 rubygems

Version Path
hilbert-0.0.2700000 lib/qlang/parser/matrix_parser.rb
qlang-0.0.27182124 lib/qlang/parser/matrix_parser.rb