Class: Plurimath::Math::Function::Nary
- Defined in:
- lib/plurimath/math/function/nary.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#parameter_four ⇒ Object
Returns the value of attribute parameter_four.
-
#parameter_one ⇒ Object
Returns the value of attribute parameter_one.
-
#parameter_three ⇒ Object
Returns the value of attribute parameter_three.
-
#parameter_two ⇒ Object
Returns the value of attribute parameter_two.
Instance Method Summary collapse
- #==(object) ⇒ Object
-
#initialize(parameter_one = nil, parameter_two = nil, parameter_three = nil, parameter_four = nil, options = {}) ⇒ Nary
constructor
A new instance of Nary.
- #to_asciimath ⇒ Object
- #to_latex ⇒ Object
- #to_mathml_without_math_tag ⇒ Object
- #to_omml_without_math_tag(display_style) ⇒ Object
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, #font_style_t_tag, #gsub_spacing, #insert_t_tag, #invert_unicode_symbols, #latex_fields_to_print, #mathml_fields_to_print, #nary_attr_value, #omml_fields_to_print, #omml_nodes, #omml_parameter, #omml_tag_name, #r_element, #tag_name, #validate_function_formula, #validate_mathml_fields
Constructor Details
#initialize(parameter_one = nil, parameter_two = nil, parameter_three = nil, parameter_four = nil, options = {}) ⇒ Nary
Returns a new instance of Nary.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/plurimath/math/function/nary.rb', line 9 def initialize(parameter_one = nil, parameter_two = nil, parameter_three = nil, parameter_four = nil, = {}) @parameter_one = parameter_one @parameter_two = parameter_two @parameter_three = parameter_three @parameter_four = parameter_four @options = Utility.validate_left_right([parameter_one, parameter_two, parameter_three, parameter_four]) end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/plurimath/math/function/nary.rb', line 7 def @options end |
#parameter_four ⇒ Object
Returns the value of attribute parameter_four.
7 8 9 |
# File 'lib/plurimath/math/function/nary.rb', line 7 def parameter_four @parameter_four end |
#parameter_one ⇒ Object
Returns the value of attribute parameter_one.
7 8 9 |
# File 'lib/plurimath/math/function/nary.rb', line 7 def parameter_one @parameter_one end |
#parameter_three ⇒ Object
Returns the value of attribute parameter_three.
7 8 9 |
# File 'lib/plurimath/math/function/nary.rb', line 7 def parameter_three @parameter_three end |
#parameter_two ⇒ Object
Returns the value of attribute parameter_two.
7 8 9 |
# File 'lib/plurimath/math/function/nary.rb', line 7 def parameter_two @parameter_two end |
Instance Method Details
#==(object) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/plurimath/math/function/nary.rb', line 22 def ==(object) self.class == object.class && object.parameter_one == parameter_one && object.parameter_two == parameter_two && object.parameter_three == parameter_three && object.parameter_four == parameter_four && object. == end |
#to_asciimath ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/plurimath/math/function/nary.rb', line 31 def to_asciimath first_value = parameter_one&.to_asciimath || "int" second_value = "_#{parameter_two.to_asciimath}" if parameter_two third_value = "^#{parameter_three.to_asciimath}" if parameter_three fourth_value = " #{parameter_four.to_asciimath}" if parameter_four "#{first_value}#{second_value}#{third_value}#{fourth_value}" end |
#to_latex ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/plurimath/math/function/nary.rb', line 39 def to_latex first_value = parameter_one&.to_latex || "\\int" second_value = "_#{parameter_two.to_latex}" if parameter_two third_value = "^#{parameter_three.to_latex}" if parameter_three fourth_value = "{#{parameter_four.to_latex}}" if parameter_four "#{first_value}#{second_value}#{third_value}#{fourth_value}" end |
#to_mathml_without_math_tag ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/plurimath/math/function/nary.rb', line 47 def to_mathml_without_math_tag tag_name = [:type] == "undOvr" ? "munderover" : "msubsup" subsup_tag = Utility.ox_element(tag_name) new_arr = [] new_arr << validate_mathml_fields(parameter_one) new_arr << validate_mathml_fields(parameter_two) new_arr << validate_mathml_fields(parameter_three) Utility.update_nodes(subsup_tag, new_arr) end |
#to_omml_without_math_tag(display_style) ⇒ Object
57 58 59 60 61 |
# File 'lib/plurimath/math/function/nary.rb', line 57 def to_omml_without_math_tag(display_style) nary_element = Utility.ox_element("nary", namespace: "m") Utility.update_nodes(nary_element, omml_nary_tag(display_style)) Array(nary_element) end |