Sha256: 6663d9c2aa201196ca1255fb335c0e3aca6c8489ed6d06e242b9d0ce2da01fc3

Contents?: true

Size: 916 Bytes

Versions: 4

Compression:

Stored size: 916 Bytes

Contents

# frozen_string_literal: true

module Plurimath
  module Math
    class Number < Core
      attr_accessor :value

      def initialize(value)
        @value = value.is_a?(Parslet::Slice) ? value.to_s : value
      end

      def ==(object)
        object.value == value
      end

      def to_asciimath
        value
      end

      def to_mathml_without_math_tag
        Utility.ox_element("mn") << value
      end

      def to_latex
        value
      end

      def to_html
        value
      end

      def to_omml_without_math_tag
        [(Utility.ox_element("t", namespace: "m") << value)]
      end

      def insert_t_tag
        r_tag = Utility.ox_element("r", namespace: "m")
        r_tag << (Utility.ox_element("t", namespace: "m") << value)
        [r_tag]
      end

      def nary_attr_value
        value
      end

      def validate_function_formula
        false
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plurimath-0.3.9 lib/plurimath/math/number.rb
plurimath-0.3.8 lib/plurimath/math/number.rb
plurimath-0.3.7 lib/plurimath/math/number.rb
plurimath-0.3.6 lib/plurimath/math/number.rb