Class: Plurimath::Math::Number

Inherits:
Core
  • Object
show all
Defined in:
lib/plurimath/math/number.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Core

#ascii_fields_to_print, #class_name, #common_math_zone_conversion, #dump_mathml, #dump_omml, #dump_ox_nodes, #empty_tag, #extract_class_from_text, #extractable?, #filtered_values, #gsub_spacing, #invert_unicode_symbols, #latex_fields_to_print, #mathml_fields_to_print, #omml_fields_to_print, #omml_nodes, #omml_parameter, #omml_tag_name, #r_element, #tag_name, #validate_mathml_fields

Constructor Details

#initialize(value) ⇒ Number

Returns a new instance of Number.



8
9
10
# File 'lib/plurimath/math/number.rb', line 8

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

Instance Attribute Details

#valueObject

Returns the value of attribute value.



6
7
8
# File 'lib/plurimath/math/number.rb', line 6

def value
  @value
end

Instance Method Details

#==(object) ⇒ Object



12
13
14
# File 'lib/plurimath/math/number.rb', line 12

def ==(object)
  object.respond_to?(:value) && object.value == value
end

#font_style_t_tag(_display_style) ⇒ Object



42
43
44
# File 'lib/plurimath/math/number.rb', line 42

def font_style_t_tag(_display_style)
  t_tag
end

#insert_t_tag(_display_style) ⇒ Object



36
37
38
39
40
# File 'lib/plurimath/math/number.rb', line 36

def insert_t_tag(_display_style)
  [
    (Utility.ox_element("r", namespace: "m") << t_tag),
  ]
end

#nary_attr_valueObject



50
51
52
# File 'lib/plurimath/math/number.rb', line 50

def nary_attr_value
  value
end

#t_tagObject



46
47
48
# File 'lib/plurimath/math/number.rb', line 46

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

#to_asciimathObject



16
17
18
# File 'lib/plurimath/math/number.rb', line 16

def to_asciimath
  value
end

#to_htmlObject



28
29
30
# File 'lib/plurimath/math/number.rb', line 28

def to_html
  value
end

#to_latexObject



24
25
26
# File 'lib/plurimath/math/number.rb', line 24

def to_latex
  value
end

#to_mathml_without_math_tagObject



20
21
22
# File 'lib/plurimath/math/number.rb', line 20

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

#to_omml_without_math_tag(_display_style) ⇒ Object



32
33
34
# File 'lib/plurimath/math/number.rb', line 32

def to_omml_without_math_tag(_display_style)
  [t_tag]
end

#validate_function_formulaObject



54
55
56
# File 'lib/plurimath/math/number.rb', line 54

def validate_function_formula
  false
end