Sha256: aba6f5e79e7e4c90609825f6a96fe4f24dc605ee52692c20f4498a9e42cdbebd

Contents?: true

Size: 906 Bytes

Versions: 4

Compression:

Stored size: 906 Bytes

Contents

# frozen_string_literal: true

require_relative "../table"

module Plurimath
  module Math
    module Function
      class Table
        class Cases < Table
          def initialize(value = [],
                         open_paren = "{",
                         close_paren = ":}",
                         options = {})
            super
          end

          def to_unicodemath
            "Ⓒ(#{value.map(&:to_unicodemath).join("@")})"
          end

          def to_mathml_without_math_tag(intent)
            table_tag = super
            set_table_intent(table_tag) if intent
            table_tag.attributes["intent"] = ":equations" if intent
            table_tag
          end

          private

          def set_table_intent(tag)
            table = tag.nodes.find { |tag| tag.name == "mtable" }
            table["intent"] = ":cases"
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plurimath-0.8.14 lib/plurimath/math/function/table/cases.rb
plurimath-0.8.13 lib/plurimath/math/function/table/cases.rb
plurimath-0.8.12 lib/plurimath/math/function/table/cases.rb
plurimath-0.8.11 lib/plurimath/math/function/table/cases.rb