Class: Plurimath::Math::Function::BinaryFunction
- Inherits:
-
Object
- Object
- Plurimath::Math::Function::BinaryFunction
show all
- Defined in:
- lib/plurimath/math/function/binary_function.rb
Direct Known Subclasses
Base, Color, FontStyle, Frac, Inf, Int, Lim, Log, Menclose, Merror, Mod, Oint, Over, Overset, Power, Prod, Root, Semantics, Stackrel, Substack, Sum, Td, Underset
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(parameter_one = nil, parameter_two = nil) ⇒ BinaryFunction
Returns a new instance of BinaryFunction.
9
10
11
12
|
# File 'lib/plurimath/math/function/binary_function.rb', line 9
def initialize(parameter_one = nil, parameter_two = nil)
@parameter_one = parameter_one
@parameter_two = parameter_two
end
|
Instance Attribute Details
#parameter_one ⇒ Object
Returns the value of attribute parameter_one.
7
8
9
|
# File 'lib/plurimath/math/function/binary_function.rb', line 7
def parameter_one
@parameter_one
end
|
#parameter_two ⇒ Object
Returns the value of attribute parameter_two.
7
8
9
|
# File 'lib/plurimath/math/function/binary_function.rb', line 7
def parameter_two
@parameter_two
end
|
Instance Method Details
#==(object) ⇒ Object
18
19
20
21
22
|
# File 'lib/plurimath/math/function/binary_function.rb', line 18
def ==(object)
object.class == self.class &&
object.parameter_one == parameter_one &&
object.parameter_two == parameter_two
end
|
#class_name ⇒ Object
58
59
60
|
# File 'lib/plurimath/math/function/binary_function.rb', line 58
def class_name
self.class.name.split("::").last.downcase
end
|
#to_asciimath ⇒ Object
14
15
16
|
# File 'lib/plurimath/math/function/binary_function.rb', line 14
def to_asciimath
"#{class_name}#{wrapped(parameter_one)}#{wrapped(parameter_two)}"
end
|
#to_html ⇒ Object
45
46
47
48
49
|
# File 'lib/plurimath/math/function/binary_function.rb', line 45
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}#{second_value}"
end
|
#to_latex ⇒ Object
39
40
41
42
43
|
# File 'lib/plurimath/math/function/binary_function.rb', line 39
def to_latex
first_value = latex_wrapped(parameter_one) if parameter_one
second_value = latex_wrapped(parameter_two) if parameter_two
"\\#{class_name}#{first_value}#{second_value}"
end
|
#to_mathml_without_math_tag ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/plurimath/math/function/binary_function.rb', line 24
def to_mathml_without_math_tag
mrow_tag = Utility.ox_element("mrow")
mo_tag = Utility.ox_element("mo") << invert_unicode_symbols.to_s
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 ⇒ Object
51
52
53
54
55
56
|
# File 'lib/plurimath/math/function/binary_function.rb', line 51
def to_omml_without_math_tag
r_tag = Utility.ox_element("r", namespace: "m")
update_row_tag(r_tag, parameter_one) if parameter_one
update_row_tag(r_tag, parameter_two) if parameter_two
r_tag
end
|