Sha256: 6eba4235a54c844a34c6169a922dd6408bcc386beb77df066d2d288302baa453

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require_relative "unary_function"

module Plurimath
  module Math
    module Function
      class Sqrt < UnaryFunction
        def to_mathml_without_math_tag
          sqrt_tag = Utility.ox_element("msqrt")
          first_value = parameter_one&.to_mathml_without_math_tag
          sqrt_tag << first_value if first_value
          sqrt_tag
        end

        def to_omml_without_math_tag
          rad_element = Utility.ox_element("rad", namespace: "m")
          pr_element = Utility.ox_element("radPr", namespace: "m")
          pr_element << Utility.ox_element(
            "degHide",
            namespace: "m",
            attributes: { "m:val": "1" },
          )
          e_element = Utility.ox_element("e", namespace: "m")
          Utility.update_nodes(e_element, omml_value)
          Utility.update_nodes(
            rad_element,
            [
              (pr_element << Utility.pr_element("ctrl", true, namespace: "m")),
              Utility.ox_element("deg", namespace: "m"),
              e_element,
            ],
          )
          [rad_element]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plurimath-0.3.7 lib/plurimath/math/function/sqrt.rb
plurimath-0.3.6 lib/plurimath/math/function/sqrt.rb