Sha256: 996ad2f203dab474d39ad6ac39d47b7b07bf531bd8ca4779daa7880053e2e63d

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require_relative "binary_function"

module Plurimath
  module Math
    module Function
      class Over < BinaryFunction
        def to_asciimath
          first_value = wrapped(parameter_one)
          second_value = wrapped(parameter_two)
          "frac#{first_value}#{second_value}"
        end

        def to_mathml_without_math_tag
          mover_tag    = Utility.ox_element("mfrac")
          first_value  = parameter_one&.to_mathml_without_math_tag
          second_value = parameter_two&.to_mathml_without_math_tag
          Utility.update_nodes(
            mover_tag,
            [
              first_value,
              second_value,
            ],
          )
        end

        def to_latex
          first_value = parameter_one&.to_latex
          two_value = parameter_two&.to_latex
          "{#{first_value} \\over #{two_value}}"
        end

        def to_omml_without_math_tag
          f_element   = Utility.ox_element("f", namespace: "m")
          fpr_element = Utility.ox_element("fPr", namespace: "m")
          Utility.update_nodes(
            f_element,
            [
              fpr_element << Utility.pr_element("ctrl", true, namespace: "m"),
              omml_parameter(parameter_one, tag_name: "num"),
              omml_parameter(parameter_two, tag_name: "den"),
            ],
          )
          [f_element]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plurimath-0.3.9 lib/plurimath/math/function/over.rb
plurimath-0.3.8 lib/plurimath/math/function/over.rb