Class: Plurimath::Math::Function::Mod

Inherits:
BinaryFunction show all
Defined in:
lib/plurimath/math/function/mod.rb

Instance Attribute Summary

Attributes inherited from BinaryFunction

#parameter_one, #parameter_two

Instance Method Summary collapse

Methods inherited from BinaryFunction

#==, #all_values_exist?, #any_value_exist?, #initialize

Methods inherited from Core

#class_name, #empty_tag, #extract_class_from_text, #extractable?, #font_style_t_tag, #insert_t_tag, #nary_attr_value, #omml_parameter, #omml_tag_name, #r_element, #tag_name, #validate_function_formula

Constructor Details

This class inherits a constructor from Plurimath::Math::Function::BinaryFunction

Instance Method Details

#to_asciimathObject



9
10
11
12
13
# File 'lib/plurimath/math/function/mod.rb', line 9

def to_asciimath
  first_value = parameter_one&.to_asciimath
  second_value = parameter_two&.to_asciimath
  "#{first_value} mod #{second_value}"
end

#to_htmlObject



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

def to_html
  first_value = "<i>#{parameter_one.to_html}</i>" if parameter_one
  second_value = "<i>#{parameter_two.to_html}</i>" if parameter_two
  "#{first_value}<i>mod</i>#{second_value}"
end

#to_latexObject



30
31
32
33
34
# File 'lib/plurimath/math/function/mod.rb', line 30

def to_latex
  first_value = "{#{parameter_one.to_latex}}" if parameter_one
  second_value = "{#{parameter_two.to_latex}}" if parameter_two
  "#{first_value} \\mod #{second_value}"
end

#to_mathml_without_math_tagObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/plurimath/math/function/mod.rb', line 15

def to_mathml_without_math_tag
  mrow_tag = Utility.ox_element("mrow")
  mo_tag = Utility.ox_element("mi") << "mod"
  first_value = parameter_one&.to_mathml_without_math_tag if parameter_one
  second_value = parameter_two&.to_mathml_without_math_tag if parameter_two
  Utility.update_nodes(
    mrow_tag,
    [
      first_value,
      mo_tag,
      second_value,
    ],
  )
end

#to_omml_without_math_tag(display_style) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/plurimath/math/function/mod.rb', line 42

def to_omml_without_math_tag(display_style)
  values = []
  values << parameter_one.insert_t_tag(display_style) if parameter_one
  values << r_element("mod")
  values << parameter_two.insert_t_tag(display_style) if parameter_two
  values
end