Sha256: 69213a7d80d3e43b2149c000b5251cfcb00bdc5f6f8641399811a1557bf6e999

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

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(_display_style)
        [(Utility.ox_element("t", namespace: "m") << value)]
      end

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

      def font_style_t_tag(_display_style)
        Utility.ox_element("t", namespace: "m") << value
      end

      def nary_attr_value
        value
      end

      def validate_function_formula
        false
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
plurimath-0.5.0 lib/plurimath/math/number.rb
plurimath-0.4.4 lib/plurimath/math/number.rb
plurimath-0.4.3 lib/plurimath/math/number.rb
plurimath-0.4.2 lib/plurimath/math/number.rb
plurimath-0.4.1 lib/plurimath/math/number.rb